...

View Full Version : document.write for a link in Safari ?



IceWendigo
09-03-2011, 01:57 PM
Hello,

Im testing the use of document.write and Im having trouble making a link work in Safari



document.write('<a href="index.htm"><img src="./images/portrait2.png"></a>');



This works in FF and IE9 but not in Safari (nor in Chrome), In Safari I see the portrait just fine but the cursor doesnt change when overing the image and clicking on it doesnt activate the link.
What is the correct way to write this line?

I have tried this and it also doesnt work in Safari and Chrome:


document.write("<a href='index.htm'><img src='./images/portrait2.png'></a>");

thanks for any insight

sunfighter
09-03-2011, 05:11 PM
Your code is correct. I tried it in Safari and it worked strieght off. I had to set chrome to allow javascript; it's turn off by default.

I placed the code inside of script tags in my header like this:

<html>
<head>
<script type="text/javascript">
document.write('<a href="test_1.html"><img src="./images/2.png"></a>');
</script>
</head>
<body>
I had to place my image and page in there, but it's the same code.

Check you JS setting in those browsers.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum