Click to See Complete Forum and Search --> : Javascript Hyperlink


DarkArchon
01-21-2004, 09:30 AM
Here's the problem, I'm looking for a way to make a hyperlink in pure Javascript. The reason for this is that I'm working with a program for building websites that will automatically put a javascript opennewwindow in front of any <a href=" tag. I don't want it to do this and unfortunity there is no way to get rid of this.

So my question is this, is there a way to make a link in JS (or anything else) without useing <a href="> ? Thanks in advance for any help you guys can give me.

-DarkArchon

jaegernaut
01-21-2004, 09:35 AM
Have you tried writing the href from javascript?

like so:

<script type="text/javascript">
document.write("<a href="yourlink.html">Link</a>");
</script>

fredmv
01-21-2004, 09:43 AM
Originally posted by jaegernaut
document.write("<a href="yourlink.html">Link</a>");That wouldn't work. In this case, you could simply escape the quotes, however, there are easier and more efficent ways (e.g., using single quotes for the statement so then you can use double quotes on all attribute values, or using pure DOM).

I believe this was already answered in this thread (http://forums.webdeveloper.com/showthread.php?s=&threadid=25702).

jaegernaut
01-21-2004, 09:46 AM
Thanks Fred,

Yep, I didn't notice I double quoted everything.

fredmv
01-21-2004, 09:49 AM
No problem. I just figured I'd point that out to avoid confusion — so if the original poster (or someone else) tried using your code he would know how to fix it.