?
Solved

using a JavaScript variable in HTML link

Posted on 2000-04-18
2
Medium Priority
?
153 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 120 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
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 …
Suggested Courses

840 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