Solved

using a JavaScript variable in HTML link

Posted on 2000-04-18
2
140 Views
Last Modified: 2010-04-09
I already got a JavaScript variable,
How can I use it to create a link,
for example:

<script language="JavaScript">
var1=........
</script>

now, I want to use var1 as:

<a href="http://zmerd01h/oam/tracker/employee.idc?T1=var1></a>

How can I make above link work?

Thank you.
                  
 
0
Comment
Question by:peteryanliu
  • 2
2 Comments
 
LVL 8

Accepted Solution

by:
xabi earned 30 total points
ID: 2727205
<a href="javascript:document.location='http://zmerd01h/oam/tracker/employee.idc?T1=' + var1"></a>

xabi
0
 
LVL 8

Expert Comment

by:xabi
ID: 2727212
Even better:

<a href="javascript:document.location='http://zmerd01h/oam/tracker/employee.idc?T1=' + escape(var1)"></a>

xabi
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question