Now, I have seen something like this...

I believe it has to do with when Javascript actually does things (don't
ask me why).  In other words because of the type of event changing the
cursor is, it doesn't happen until after the function is completed.  So
if you stuck it in another function and called it separately (somehow),
it may work.

I could be way off the mark though, but there's something triggering my
brain to think this way...

Paul

> Have an HTML tree-display where each node has a checkbox next 
> to it. When a user ticks a parent node, the onClick calls a 
> function which selects or deselects the checkboxes for any 
> child nodes.
> 
> Some users have a large number of checkboxes and the browser 
> freezes for up to a ten seconds when one of the parent boxes 
> is checked, so I've been asked to change the cursor to an 
> hourglass to inform the user something is happening. This 
> code below works fine when it's on a page on its own:
> 
> 
> <script language="JavaScript" type="text/javascript">
> <!-- 
> function wait() {
>       document.body.style.cursor = "wait";
> }
> function resume() {
>       document.body.style.cursor = "default";
> }
> // -->
> </script>
> 
> <a href="javascript:wait();">wait</a><br>
> <a href="javascript:resume();">resume</a>
> 
> 
> However, when you have the document.body.style.cursor = 
> "wait" as the first line of the function that does the 
> checking / unchecking, you don't get to see the hourglass 
> (code below). Any idea why? Thanks.
> 
> 
> <script language="JavaScript" type="text/javascript">
> <!-- 
> // toggleCheck() toggles the checked state of child 
> checkboxes. function toggleCheck(parentElementNo) {
>    document.body.style.cursor = "wait";                       
>       // Set
> the cursor to an hourglass
> 
>    var parentElement = document.forms[0].elements[parentElementNo];
>    var thisElementNo = parentElementNo + 1;
>    var thisElement = document.forms[0].elements[thisElementNo];
> 
>    // If we are looking at a descendent of the element passed 
> into the function,
>    while (thisElement.id.substring(0, parentElement.id.length) ==
> parentElement.id) {
>       // set its checkbox to the same state as its parent.
>       thisElement.checked = parentElement.checked;
> 
>       // If we haven't reached the end of the form
>       if (thisElementNo < document.forms[0].elements.length) {
>          // increment the element number.
>          thisElementNo++;
>          thisElement = document.forms[0].elements[thisElementNo];
>       // Otherwise, break out of the while loop.
>       } else {
>          break;
>       }
>    }
> 
>    document.body.style.cursor = "default";;           // Set the
> cursor back to the pointer.
> }
> // -->
> </script>
> 
> 
> -- 
> Aidan Whitehall <mailto:[EMAIL PROTECTED]>
> Macromedia ColdFusion Developer
> Fairbanks Environmental Ltd  +44 (0)1695 51775
> Queen's Awards Winner 2003 <http://www.fairbanks.co.uk/go/awards>
> 
> Fairbanks uses anti-spam filtering. If you sent an e-mail and 
> expected to receive a response but didn't, please call -- it 
> may be that your e-mail didn't make it to the intended mailbox.
> 
> ______________________________________________________________
> __________
> This e-mail has been scanned for all viruses by Star 
> Internet. The service is powered by MessageLabs. For more 
> information on a proactive anti-virus service working around 
> the clock, around the globe, visit: http://www.star.net.uk 
> ______________________________________________________________
> __________
> 
> -- 
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
> 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: 
> [EMAIL PROTECTED] For human help, e-mail: 
> [EMAIL PROTECTED]
> 



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to