Good all the time of day, gentlemen.

<script> function subm() { document.forms['form1'].submit(); } setTimeout(subm, 1); </script> <form id="form1" name="form1" method="post" action=""> <label> <input type="hidden" name="textfield" id="textfield" /> </label> <label> <input type="button" name="go" id="go" value="" onclick="subm()" /> </label> </form> 

This code, when added to the page, makes it updated (F5) at a specified time interval. setTimeout (subm, 1); - means 1/1000 seconds. Actually the code suits. Is it possible in some way for the update function to hang on a form? (Ideally, just to have a script with the time in it).

    1 answer 1

    You can probably somehow like this:

     <script> function reloadPage(timeToReloadAfter) { setTimeout("location.reload();",time); } </script> ... <body onload="reloadPage(1000)"> ... </body> 
    • one
      remove quotes, eval is not needed here at all - karmadro4
    • justify? - Chad
    • I am happy to answer, but why are you not resting on a pancake on Saturday? 8-) - sergey
    • > justify? what exactly! ;-) - karmadro4
    • one
      A call to setTimeout with a string argument is the essence of eval , and, as you know, eval is evil . In this particular case, the equivalent behavior with pure code can be achieved simply by removing the punctuation. > why it cannot be used In principle, this topic is worthy of a separate issue. - karmadro4