Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript_howto thread: SV: Disabling a button for 10 seconds


Message #1 by "Robert Nyman" <robert.nyman@c...> on Sun, 6 Oct 2002 12:39:09 +0200
setTimeout("parent.frameName.dcoument.getElementById('buttonID'.disabled
=3D false, 10000)"
I haven't tested this code, but the basic idea is using a setTimeout.


More info, see:

http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/settim
eout.asp
http://www.mozilla.org/docs/dom/domref/dom_window_ref116.html


/Robert


-----Ursprungligt meddelande-----
Fr=E5n: Sebastiaan Janssen [mailto:genuine2001@h...]
Skickat: den 6 oktober 2002 11:41
Till: JavaScript HowTo
=C4mne: [javascript_howto] Disabling a button for 10 seconds


How would I go about disabling a form submit button for 10 seconds after

it's been pushed?
I'm posting data to another frame and I want to prevent post flooding.

I've made it so that, when you push the button, it checks if all form
fields are filled in.
So the submit button already looks like this:

<input name=3D"submit" id=3D"submit" type=3D"submit" value=3D"Post"
onClick=3D"validateForm('name','','R','tagText','','R');return
document.returnValue;" />

First thing I want to do is disable this button as soon as it is
pressed,
how do I add that code?

Then, I want to trigger the timer from the other frame. This I can do
with onLoad, but how do I write a function that will wait for ten
seconds
and then enable the button again?

Thanks!
Sebastiaan.

---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20


  Return to Index