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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hourglass

Status
Not open for further replies.

jl8789

MIS
May 22, 2003
293
0
0
US
New to javascript!

How do I disable the mouse pointer to an hourglass after a user clicks the OK button so that they can't click it again until it is done processing?

THANKS!
 
Code:
<script language='Javascript'>
function somefunction(btn) {
   //your code here to do your processing
   btn.disabled=false;
}
</script>
<input type=button value='click me' name=blahButton onclick='this.disabled=true;somefunction(this);'>
I threw the 'this' reference into your processing function so that multiple buttons could call the same function and you wouldn't have to code an if statement for each one. Doesn't change the mouse to an hourglass, but it does prevent the button from being clicked multiple times in a row.

-kaht

banghead.gif
 
It doesn't disable the button I have. I'm guessing it's because I am using a style sheet...

<td class=&quot;tbutton&quot; width=75 onclick=&quot;this.disabled=true; processForm(this);&quot;>

You would think it would at least disable the object when clicked?
 
yeah.... I don't know that you can disable a <td> which is what your code is trying to do. Maybe there's an element within your class that you can disable. Hard for me to say w/o seeing what's inside your class.

-kaht

banghead.gif
 
Here is part of my style sheet with the tbutton class I am using

.tbutton, .tbuttonp {cursor: hand; background-color: NAVY; text-align: center;}
.tbutton {text-align: center; border-left: solid 2px #FFFFFF; border-top: solid 2px #FFFFFF; border-right: solid 2px #7694C8; border-bottom: solid 2px #7694C8;}
.tbuttonp {text-align: center; border-right: solid 2px #FFFFFF; border-bottom: solid 2px #FFFFFF; border-left: solid 2px #7694C8; border-top: solid 2px #7694C8;}
.tbutton A, .tbutton A:visited, .tbuttonp A, .tbuttonp A:visited {text-decoration: none; color: black;}

 
Ss there any onclick events in your class? Looks like what you posted is just cosmetic stuff.

-kaht

banghead.gif
 
That's all there is to the tbutton class.

You mean to tell me that there is on way to disable the mouse pointer to an hour glass, and then back to a regular pointer when the processing is over?

Don't they do that all the time in windows?
 
This still allows me to click the button more than once...

<input type=&quot;button&quot; value='OK' name=&quot;okbutton&quot; onclick='this.disabled=true;processForm(this);'>

function processForm(btn) {
doOk();
btn.disabled=false;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top