using a JavaScript variable in HTML link

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.
                  
 
peteryanliuAsked:
Who is Participating?
 
xabiConnect With a Mentor Commented:
<a href="javascript:document.location='http://zmerd01h/oam/tracker/employee.idc?T1=' + var1"></a>

xabi
0
 
xabiCommented:
Even better:

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

xabi
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.