Web Analytics Made Easy -
StatCounter document.write for a link in Safari ? - CodingForum

Announcement

Collapse
No announcement yet.

document.write for a link in Safari ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • document.write for a link in Safari ?

    Hello,

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


    Code:
    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:

    Code:
    document.write("<a href='index.htm'><img src='./images/portrait2.png'></a>");
    thanks for any insight

  • #2
    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:
    Code:
    <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.
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

    Comment

    Working...
    X