Possible Duplicate:
How to use JavaScript variable in an HTML link
The website that I am working on has a <base>
tag point to a pre-established URL. What I would like to do is get around the <base>
tag by using the trueURL bellow to find the url of the webpage.
I need this variable because i would like to construct some internal anchors that will point to different parts of the webpage.
The issue that im having is that i don't know how i should use the url that i store in my trueURL variable. Is it possible to use it and then add extra extensions to the url to get it to point to my anchors?
var trueURL = window.location.href;
The following is what I would like to obtain :
<html>
<ol>
<li>
<a href= [trueURL] + "#link1">Link1</a>
</li>
<li>
<a href= [trueURL] + "#link2">Link2</a>
</li>
<li>
<a href= [trueURL] + "#link3">Link2</a>
</li>
</ol>
</html>
Therefore in the end i would like to have link1, for example, to look like trueURL#link1.