Prev: Background changes to blue color when a popup is moved across in IE8
Next: FAQ Topic - Why does framename.print() not print the correct frame in IE? (2010-06-21)
From: MG on 20 Jun 2010 16:39 "Gregor Kofler" <usenet(a)gregorkofler.com> wrote in message news:hvlnal$5b7$1(a)newsreader2.utanet.at... > Am 2010-06-20 20:13, MG meinte: >> I am a newbie. >> >> On this page: >> http://www.blighty.co.za/resetform/ >> I am testing a script to reset a form after it has been submitted. >> >> I have this line: >> setTimeout('mf.reset()',10000); > > mf.reset() is executed immediately and the result becomes the argument for > the setTimeout method. > > window.setTimeout(mf.reset, 10000); > > is what you want. > > > Gregor I tried your suggestion (plus a few variations), but still there is no 10 sec delay. MG
From: MG on 20 Jun 2010 16:42 "Luuk" <luuk(a)invalid.lan> wrote in message news:hv32f7-n0l.ln1(a)qqqqq.xs4all.nl... > Op 20-6-2010 20:13, MG schreef: >> I am a newbie. >> >> On this page: >> http://www.blighty.co.za/resetform/ >> I am testing a script to reset a form after it has been submitted. >> >> I have this line: >> setTimeout('mf.reset()',10000); >> There should be a 10 second delay before the form resets. But the form >> resets almost immediately. >> >> I have stared at the code for a long time and just cannot figure out why >> there is no 10 second delay. >> >> Hope someone can help. >> >> Thanks >> MG >> >> > > change 'return true' to 'return false' > so your form does not get submitted, > which clears the form I want the form to be submitted. Then, after a delay, the form is to be reset. > there is an additional bug in the function, > but my knowledge of javascript will not allow to solve it now ;) My knowledge of javascript doesn't allow me to solve it either :( MG
From: MG on 20 Jun 2010 17:02 "Garrett Smith" <dhtmlkitchen(a)gmail.com> wrote in message news:hvlt7e$h3e$1(a)news.eternal-september.org... > On 2010-06-20 11:40 AM, Gregor Kofler wrote: >> Am 2010-06-20 20:13, MG meinte: >>> I am a newbie. >>> >>> On this page: >>> http://www.blighty.co.za/resetform/ >>> I am testing a script to reset a form after it has been submitted. >>> >>> I have this line: >>> setTimeout('mf.reset()',10000); >> >> mf.reset() is executed immediately and the result becomes the argument >> for the setTimeout method. >> > > No, that is not what happens. > > When setTimeout is supplied a string argument, as is the case with > 'mf.reset()', the string is evaluated after pausing for the delay given as > the second parameter, in this case 10000 ms. > > setTimeout("alert(1)", 10000); > > In the OP's example, the function is not called for a different reason. > The OP is still trying to figure that out, so I'm not going to give that > reason away. Yes, I am still trying to figure that out. I would appreciate it if you did give the reason away. MG
From: Garrett Smith on 20 Jun 2010 17:09 On 2010-06-20 01:42 PM, MG wrote: > "Luuk"<luuk(a)invalid.lan> wrote in message > news:hv32f7-n0l.ln1(a)qqqqq.xs4all.nl... >> Op 20-6-2010 20:13, MG schreef: >>> I am a newbie. >>> >>> On this page: >>> http://www.blighty.co.za/resetform/ >>> I am testing a script to reset a form after it has been submitted. >>> >>> I have this line: >>> setTimeout('mf.reset()',10000); >>> There should be a 10 second delay before the form resets. But the form >>> resets almost immediately. >>> >>> I have stared at the code for a long time and just cannot figure out why >>> there is no 10 second delay. >>> >>> Hope someone can help. >>> >>> Thanks >>> MG >>> >>> >> >> change 'return true' to 'return false' >> so your form does not get submitted, >> which clears the form > > I want the form to be submitted. Then, after a delay, the form is to be > reset. > How is that going to be possible? What do you think happens when you submit the form? Garrett
From: Evertjan. on 20 Jun 2010 17:16
MG wrote on 20 jun 2010 in comp.lang.javascript: > I want the form to be submitted. Then, after a delay, the form is to be > reset. > That can only be done, if you submit the form to another window, otherwise there is NO form of the old page to be reset, because that page is gone and exchanged for a new version with a new form. Try: <form onsubmit = "setTimeout('resetMe()',10000);"; target = 'anotherWindow'; > However, submitting to the same window automagically "resets" the form without the need of any javascript, because you will see a new empty form. -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress) |