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>
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>

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.

thanks for your reply.

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

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().

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.