0

How do I use hour glass in java script?

I have a jsp page, I'm calling in the javascript when I click the submit button like below.

function show(table)

{

document.forms["form1"].action ="employee.do?";

document.forms["form1"].submit();
document.forms.style.cursor = 'wait';

}
jsp Page:

<html:form action ="/doemployee" method ="post">

<table>
<tr>

<td>
<input type="button"  name="emp" value ="empdetails" onclick="show('dept')" class="boxStyle" />
</td>

</tr>
</table>

But it is not changing to hour galss. 

How would do I change to hour glass when I click the submit button? 

thanks 


</html>
2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by fxm
0
document.forms.style.cursor = 'wait';

change to hour glass when I click the button?

There are two problems: the cursor needs to be changed for the body (not the element) and it may need to be changed back.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta name="generator" content=
    "HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <script type="text/javascript">

    function waiter() { 
    document.body.style.cursor='wait'; 
    } 
    </script>
    <title></title>
  </head>
  <body onload="document.body.style.cursor='default'">
    <pre>


</pre>

<button type="button" onclick="waiter();">Click Me!</button>

    <pre>


</pre>
  </body>
</html>
0

Just to be clear...
The onload="document.body.style.cursor='default'" shown here doesn't actually do anything useful; it was merely intended to show what an event-triggered change of the cursor might look like.

Edited by fxm: n/a

0

thanks for your reply.

How would I change to hour glass. on already existing button.onclick="show('dept')" ?

Edited by lak123: n/a

0

How would I change to hour glass. on already existing button.onclick="show('dept')" ?

Fix the existing .style statement and put it before the submit().

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.