Hi m miller,
Thank you for the response. I think I've got your definite requirement, you
have to do some data retrieving operation which may take some pieces of
time when the ServerControl button is clicked. Since the operation won't be
finished in a short time, you want to set the client's cursor state to
"wait". I've done some further test on my side and you may try out the
following code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>CursorTest</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script language="javascript">
function ChangeCursor()
{
//alert(document.body.style.cursor)
if (document.body.style.cursor == "wait")
{
document.body.style.cursor="default";
document.Form1.txt2.focus();
}
else
{
document.body.style.cursor="wait";
document.Form1.txt2.focus();
}
}
</script>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<table width="500" border="1" align="center">
<tr>
<td><INPUT id="txt1" type="text" runat="server"></td>
<td></td>
</tr>
<tr>
<td><FONT face="ËÎÌå"><INPUT id="txt2" type="text"
runat="server"></FONT></td>
<td>
<asp:Button id="btnServer" runat="server" Text="Server
Button"></asp:Button></td>
</tr>
</table>
</form>
</body>
</HTML>
---------------------code behind---------------------
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
btnServer.Attributes.Add("onclick","ChangeCursor() ");
}
private void btnServer_Click(object sender, System.EventArgs e)
{
System.Threading.Thread.Sleep(1000*10);
Response.Write("<br>Server Button is clicked at:"+
DateTime.Now.ToLongTimeString());
}
Notice that the "document.body.style.cursor" is empty at first, so we can
check the cursor state like:
if (document.body.style.cursor == "wait")
{.......}else{.......}
And I use "System.Threading.Thread.Sleep(1000*10);" in the Serverside
button's click event to simulate the long time Data retrieving operation
you mentioned.
Hope it is helpful. If you have any question on it ,please feel free to
let me know.
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)