maybe i'm reading your code wrong (it's all garbled on my display), but it
looks like you're setting it back to the default cursor as the last line in
your function?


Duncan Cumming
IT Manager

http://www.alienationdesign.co.uk
mailto:[EMAIL PROTECTED]
Tel: 0141 575 9700
Fax: 0141 575 9600

Creative solutions in a technical world

----------------------------------------------------------------------
Get your domain names online from:
http://www.alienationdomains.co.uk
Reseller options available!
----------------------------------------------------------------------
----------------------------------------------------------------------


                                                                                       
                                     
                    "Aidan Whitehall"                                                  
                                     
                    <[EMAIL PROTECTED]        To:     <[EMAIL PROTECTED]>              
                       
                    nks.co.uk>                    cc:                                  
                                     
                                                  Subject:     [ cf-dev ] OT: 
JavaScript and hourglass                      
                    14/01/2004 14:40                                                   
                                     
                    Please respond to dev                                              
                                     
                                                                                       
                                     
                                                                                       
                                     



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