FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

JS Disable Button.

 


moejoe
Hey Guys.

I need to make a script to people dnt press submit twice. So far the only thing i got working is onClick = "this.disabled=true;" and that worked fine.

But i Have a JS form checker (to see if everything is filled in) and i need this code in my function().

So far in my Else {} [the else means everything is ok]
I have

Code:

 else{
 window.status='Processing Request... Please Wait';
 return true;
 }


I want to Disable my button also in this process and change it's value to 'Processing'

I've tried this:
Code:

 else{
 window.status='Processing Request... Please Wait';
 document.form.Button.disabled=true;
 document.form.Button.value='Processing';
 return true;
 }


The window status line works fine, but the rest doesn't.

Thanks for your help! Smile
Stubru Freak
There's the easy way and the hard way!

Easy:
document.getElementById('GiveTheButtonAnID').disabled='disabled';

Hard:
Call the function with function(event), then get event['srcElement'].disabled or event['target'].disabled (one for IE, one for the rest) then change that value.
moejoe
worked a treat.
Thanks!
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.