I have a page that is accessed via another page which will always include with it one of four possible values in the query string. I need to add to my page a link with the URL dependent on the value of the query string. I have the code to determine the proper URL. It is along the lines of:
if (location.search == “?a”)
{
myURL = “page_a.htm”
etc.
My question is how to code the link to pick up myURL as the href value. I tried the following without success:
<a href=”<script type=’text/javascript’>document.write(myURL)</script>”>Text to display to user</a>
It does work if I document.write the whole line, like this:
<script type=”text/javascript”>document.write(“<a href=”+myURL+”>Text to display to user</a>”)</script>
Just wondered if there was another way. I think it is the ASP part of my brain speaking.