By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,806 Members | 1,343 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,806 IT Pros & Developers. It's quick & easy.

Javascript to post a form automaticaly ?

P: 1
Hello there,

I'm just wondering something. I did a form on a page, form which contains already some values. Is it possible to do a script that posts the form automaticaly after X seconds ?

Thanks a lot :-)

Cyrille
Feb 13 '07 #1
Share this Question
Share on Google+
4 Replies

iam_clint
Expert 100+
P: 1,208
for example.
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. timeout = window.setTimeout("document.getElementById('formsid').submit()", 3000);
  3. </script>
  4. <form id="formsid" method="get" action="blah">
  5. </form>
  6.  
  7.  
change 3000 to whatever time u want
1000 = 1 second
2000 = 2 seconds
3000 = 3 seconds ect...
Feb 13 '07 #2

dmjpro
100+
P: 2,476
u can also using window.setInterval(fun_ref,mill_secs) instead of using window.setTimeout
Feb 14 '07 #3

iam_clint
Expert 100+
P: 1,208
the problem with setinterval is it could fire again before it finishes posting the data

Difference between setTimeout and setInterval is that setInterval calls the function over and over again untill you tell it to stop and setTimeout only calls the function once.
Feb 14 '07 #4

acoder
Expert Mod 15k+
P: 16,027
Yes, see this page.
Feb 14 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.