violet kiwi
violet kiwi

Reputation: 705

endless connecting loop in firefox

<!DOCTYPE html>
<html>
    <head>
        <meta charset=utf-8 />
        <title>JS Bin</title>
        <script type="text/javascript">
            function a(){
                for(i=0;i<10;i++)
                {
                    document.write(i);
                }
            }
        </script>
    </head>
    <body>
        <form>
            <input type="submit" value="submit" onClick="a();return false;">
        </form>
    </body>
</html>

Results in endless connecting.. when submit button is pressed loop in firefox tab;

what is the reason? Is there a fix?

Upvotes: 2

Views: 184

Answers (1)

t.niese
t.niese

Reputation: 40852

because firefox expects a document.close(); if you are finished with writing.

the endless connecting is the indicator that something is still going on.

 <script type="text/javascript">
   function a(){
    for(i=0;i<10;i++)
    {
          document.write(i);
    }
    document.close();
   }
  </script>

Upvotes: 3

Related Questions