FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free 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!
Related topics
To rainbox or not to rainbox?
Windows XP Tricks & Tips!!!!
How to expired a page so a user cannot press back button ?
How can I disable the back button of my browser?
Disabling a textbox on click of a radio button
Making a Dynamic link button
Need help fixing some js.. F$500 (long post)
[request][html+js]please find the error in this code
does javaScript code runs on selected browsers?
Disable Right Click On ANy Browser
Disable a button when clicked
Compose an algorithm to disable a button?
Automatic disable of replies?
Improve Frihost with (gr)8 Greasemonkey scripts
Reply to topic    Frihost Forum Index -> Scripting -> Others

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