Results 1 to 3 of 3

Thread: [Resolved] JavaScript: document.write in a function

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2005
    Location
    Canada
    Posts
    66

    Resolved [Resolved] JavaScript: document.write in a function

    Does anyone know why document.write hangs my browser with the code below. Commenting document.write out solves the problem.

    Thanks,

    <html>
    <head>
    <title>Functions</title>

    <script language="JavaScript"
    type="text/javascript">
    function addem(){ // function defined within <head> tags
    var n = 2;
    var y = 3;
    //alert("hi");
    document.write( n + y, "<br>");
    }
    </script>

    </head>
    <body bgcolor=red>

    <a href="javascript:addem()">Click here</a>

    <h2>Hello</h2>

    </body>
    </html>
    Last edited by whiteWay; Oct 29th, 2005 at 05:15 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width