using a JavaScript variable in HTML link

Posted on 2000-04-18
Medium Priority
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">

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.
Question by:peteryanliu
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

Accepted Solution

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


Expert Comment

ID: 2727212
Even better:

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


Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
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

762 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