Solved

using a JavaScript variable in HTML link

Posted on 2000-04-18
2
147 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

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
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
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 …

691 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