Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable a input button on click

Status
Not open for further replies.
Jan 11, 2007
51
I want to disable a button when the user clicks it. Here is my button html:

Code:
<input type="button" style="submit" value="SEND" onclick="this.disabled=true;send(<%=this.thisUser.UserId%>);" class="send" />

IE does not give me an error when its click, but also it does not disable it.
 
Testing your code without the call to send() using IE 6 disabled the button as expected. Have you tried it without calling the send() function? If it works fine that way, the problem is with that function or with the parameter you're passing to it. You might try putting the parameter value in quotes, in case it isn't totally numeric:

Code:
<input type="button" style="submit" value="SEND" onclick="this.disabled=true;send('<%=this.thisUser.UserId%>');" class="send" />

Lee
 
Hi Lee,

I removed the function call Send(); and still the same effect. I was testing this on FireFox 2.0. I then switched to IE, to see what error message it would give me, and it worked! So I guess the problem FireFox does not like this function... do know a workaroudn in FF?

-- Jenni
 
Other than a complaint about the style being called submit, I had no problem with the code in Firefox 1.5.

Did you mean that the class should be submit? There are no style elements I'm aware of named that.

Lee
 
Works for me as well in FF 1.5 and IE6. even with the style="submit" line in there.

Double check what the value being suppied in <%=this.thisUser.UserId%> is coming out as also, though if you removed the call to the send function entirely it should not be an issue.


At my age I still learn something new every day, but I forget two others.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top