[Javascript] Auto-submit form every X minutes

Paul Novitski paul at juniperwebcraft.com
Tue Jan 30 11:32:48 CST 2007


At 1/30/2007 09:01 AM, Alan Easton wrote:
>I am wanting to auto-submit a form every x mins. I have the following code.
>
><script type="text/javascript">
>function reFresh() {
>  document.form.submit();
>}
>window.setInterval("reFresh()",10000);
></script>
>
>However, this is an ASP page, and I have 4 submit buttons, each 
>performing different actions on the page. The page gets submitted to 
>itself, and I grab the name of each button and perform something different.
>
>I would like to simply add a auto-save, so is there anyway I can use 
>JS to auto submit one of those buttons that I already have, like 
>instead of it being clicked, it is captures in an onsubmit event or something.


I suppose you could invoke the click() method on the button of your choice.
http://developer.mozilla.org/en/docs/DOM:element.click

Also don't forget you can create and modify hidden input elements on 
the fly to feed whatever values you need to the server on submit.
http://www.w3.org/TR/html4/interact/forms.html#hidden-control

Regards,

Paul
__________________________

Juniper Webcraft Ltd.
http://juniperwebcraft.com 




More information about the Javascript mailing list