WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Global Cursor Change, Idris, February 15, 2005
     Re:Global Cursor Change , Jonas, February 24, 2005
     Re:Global Cursor Change, Jeffrey Jangli, February 17, 2005
         Re:Global Cursor Change, Idris, February 18, 2005
             Re:Global Cursor Change, Jeffrey Jangli, February 21, 2005
                 Re:Global Cursor Change, Jeffrey Jangli, February 21, 2005
                     Re:Global Cursor Change, Jennifer Xu, June 20, 2005
                     Re:Global Cursor Change, Guilherme Blanco, February 21, 2005

Subject: Re:Global Cursor Change From: Guilherme Blanco Date: February 21, 2005

And here is a more optimized one:

function switchStatus(m)
{
    m = (m) ? m : "wait";
    var a = document.getElementsByTagName("A");
    document.body.style.cursor = m;
    for (var i = 0; i < a.length; i++)
        a[i].style.cursor = m;
}

javascript:switchStatus(); => will put in wait cursor
javascript:switchStatus("pointer") => will put all in pointer cursor
javascript:switchStatus("")

Cheers,
Gui Blanco

From: Jeffrey Jangli
Sent: Feburary 21, 2005
Subject: Re:Global Cursor Change

I posted too soon, here's the cleaned-up version:

<html>
<head>
<script type="text/javascript">
function switchStatus(m)
{
 var i,l,a=document.getElementsByTagName("A");
 document.body.style.cursor=(m)?"wait":"";
 for(i=0,l=a.length;i<l;i++)a[i].style.cursor=(m)?"wait":"";
};
</script>
</head>

<body>

<a href="javascript:switchStatus(0);">status DEFAULT</a>
<br />
<a href="javascript:switchStatus(1);">status BUSY</a>

</body>
</html>


 

From: Jeffrey Jangli
Sent: Feburary 21, 2005
Subject: Re:Global Cursor Change

...and here's the javascript method:

<html>
<head>
<script type="text/javascript">
function switchStatus(m)
{
 var a,i,l,o=document.getElementById("idbody");

 o.style.cursor=(m)?"wait":"";
 
 a=document.getElementsByTagName("A");

 for(i=0,l=a.length;i<l;i++)a[i].style.cursor=(m)?"wait":"";
};
</script>
</head>

<body id="idbody">

<a id="idlink0" href="javascript:switchStatus(0);">status DEFAULT</a>
<br />
<a id="idlink1" href="javascript:switchStatus(1);">status BUSY</a>

</body>
</html>

From: Idris
Sent: Feburary 18, 2005
Subject: Re:Global Cursor Change

Hm, that sounds about right, but how could you do/undo that in javascript? I'm not sure if you can do pseudo-classes (like :hover) in javascript...
     -Idris

From: Jeffrey Jangli
Sent: Feburary 17, 2005
Subject: Re:Global Cursor Change

Here's the easy method:

<style type="text/css">
body{cursor:wait;}
a:hover{cursor:wait;}
</style>

From: Idris
Sent: Feburary 15, 2005
Subject: Re:Global Cursor Change

Does anyone know of a way to do a "global" cursor change on a page? For example while loading, I want the cursor to change to an hourglass, then change back later. However, if I do this now, for example on the body, the cursor still changes back to a hand when you mouseover a link. How can I make it stay the hourglass no matter where the mouse is?

-Idris









Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX