Page 1 of 1

Links In Javascript?

Posted: Mon Jun 09, 2008 10:27 pm
by Andrew_b
document.write(""); seems to work with all of the html codes, except <a></a>

I need it to write a link, but it wont work. How do you use links in javascript? thank you.

Posted: Fri Jun 20, 2008 1:06 am
by THE-MASTER
It works for me.

Code: Select all

document.write("<a href='hello'>hello</a>");
Remember you can't use the double quote unless you escape when you have used it to surround code.

Posted: Fri Jun 20, 2008 2:09 pm
by Andrew_b
ahh yes.

I was using:

Code: Select all

document.write("<a href="Hey.html">Hey</a>")
Thanks.