473,412 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Changing mouse into hourglass over all objects including drop downs

I know this works on all objects except drop down boxes.

doc = document.all
for (i=0;i<doc.length;i++)
{
doc(i).style.cursor = 'wait';
}

Is it possible to make a cursor into an hourglass over a drop down?

Jul 22 '06 #1
5 3134
mc*******@wright.edu wrote:
I know this works on all objects except drop down boxes.

doc = document.all
document.all is a proprietary MS feature that has been copied to some
extent by other browsers, but can be considered deprecated (since IE 5)
in favour of appropriate W3C standards - in this case,
document.getElementsByTagName should do the trick but may not be necessary.

Using script to do style stuff is clumsy and should really only be done
where there is no other way.

for (i=0;i<doc.length;i++)
{
doc(i).style.cursor = 'wait';
}

Is it possible to make a cursor into an hourglass over a drop down?
If by 'drop down' you mean an HTML select element, yes. You can use a
'wait' cursor over all select elements using CSS:

<style type="text/css">
select {cursor: wait;}
</style>

You can use selectors to change the cursor based on the element's id or
class attributes. You can also use in-line styles:

<select style="cursor: wait;" ... >
Do you still want to use script?
--
Rob
Jul 23 '06 #2
On Sun, 23 Jul 2006 13:24:06 +1000, RobG <rg***@iinet.net.auwrote:
>mc*******@wright.edu wrote:
>for (i=0;i<doc.length;i++)
{
doc(i).style.cursor = 'wait';
}

Is it possible to make a cursor into an hourglass over a drop down?

If by 'drop down' you mean an HTML select element, yes. You can use a
'wait' cursor over all select elements using CSS:

<style type="text/css">
select {cursor: wait;}
</style>

You can use selectors to change the cursor based on the element's id or
class attributes. You can also use in-line styles:

<select style="cursor: wait;" ... >
Do you still want to use script?
The script above is equivalent to using the above.

OP - the better approach to this is not to change every cursor -
that's really, really slow - just add a mousemove handler to the page
and change the cursor of the element under the cursor, much more
efficient.

Jim.
Jul 23 '06 #3
Jim Ley wrote:
On Sun, 23 Jul 2006 13:24:06 +1000, RobG <rg***@iinet.net.auwrote:
>mc*******@wright.edu wrote:
[...]
>>Is it possible to make a cursor into an hourglass over a drop down?
If by 'drop down' you mean an HTML select element, yes. You can use a
'wait' cursor over all select elements using CSS:

<style type="text/css">
select {cursor: wait;}
</style>

You can use selectors to change the cursor based on the element's id or
class attributes. You can also use in-line styles:

<select style="cursor: wait;" ... >
[...]
>
The script above is equivalent to using the above.

OP - the better approach to this is not to change every cursor -
that's really, really slow - just add a mousemove handler to the page
and change the cursor of the element under the cursor, much more
efficient.
Do you mean something like:

<script type="text/javascript">

function doWait(e){
var tgt = e.target || e.srcElement;
if (tgt && tgt.tagName && tgt.style){
if ('select' == tgt.tagName.toLowerCase()){
tgt.style.cursor = 'wait';
} else {
tgt.style.cursor = 'normal';
}
}
}

</script>

<body onmouseover="doWait(event);"... </body>
I think CSS provides a much more elegant solution.
--
Rob
Jul 23 '06 #4

RobG wrote:
Jim Ley wrote:
On Sun, 23 Jul 2006 13:24:06 +1000, RobG <rg***@iinet.net.auwrote:
mc*******@wright.edu wrote:
[...]
>Is it possible to make a cursor into an hourglass over a drop down?
If by 'drop down' you mean an HTML select element, yes. You can use a
'wait' cursor over all select elements using CSS:

<style type="text/css">
select {cursor: wait;}
</style>

You can use selectors to change the cursor based on the element's id or
class attributes. You can also use in-line styles:

<select style="cursor: wait;" ... >
[...]

The script above is equivalent to using the above.

OP - the better approach to this is not to change every cursor -
that's really, really slow - just add a mousemove handler to the page
and change the cursor of the element under the cursor, much more
efficient.

Do you mean something like:

<script type="text/javascript">

function doWait(e){
var tgt = e.target || e.srcElement;
if (tgt && tgt.tagName && tgt.style){
if ('select' == tgt.tagName.toLowerCase()){
tgt.style.cursor = 'wait';
} else {
tgt.style.cursor = 'normal';
}
}
}

</script>

<body onmouseover="doWait(event);"... </body>
I think CSS provides a much more elegant solution.
--
Rob
I found this script which uses the BODY method:

<html>
<head>
<script type="text/javascript">

function Change_Cursor(Param1)
{
document.body.style.cursor = Param1
}

</script>

<body>

<a href="#" onclick="Change_Cursor('wait')">Change Cursor to
Wait</a><br>
<a href="#" onclick="Change_Cursor('pointer')">Change Cursor to
Pointer</a><br>
<a href="#" onclick="Change_Cursor('default')">Change Cursor to
Default</a><br>

<form>
<select>
<option>ABCDFEGHIJKLMNO</opion>
<option>PQRSTUVWXYZ1234</opion>
<option>567890ABCDFEGHI</opion>
</select>
</form>

</body>

</html>

Problem is, when you moueover elements like the LINKS or the SELECT
box, it reverts to the default behavior for those items.

Maybe you should step through every node stemming from the BODY and
change it over? And then to reset re-step and change settings back to
default?

Someone must have code this already, right?

Giggle Girl

Jul 25 '06 #5

mc*******@wright.edu wrote:
I know this works on all objects except drop down boxes.

doc = document.all
for (i=0;i<doc.length;i++)
{
doc(i).style.cursor = 'wait';
}

Is it possible to make a cursor into an hourglass over a drop down?
I assume what you want to do is turn the hourglass on and off when
something is happening.

One solution would be to size a floating DIV to cover the whole page
with a z-index high enough to ensure it is in front of all other
elements and set the cursor just for that DIV.

You can then just show/hide the DIV as you see fit. This has the
side-effect of disabling all the elements on the page which may or may
not be what you want.

Jul 26 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: larry mckay | last post by:
does anyone have a code sample that changes the mouse cursor to an hourglass or waitcursor ? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in...
9
by: DotNetShadow | last post by:
Hi Guys, I have been having this problem recently where I have a form with a textbox and button, if in the button event I have the following: Private Sub Button1_Click(ByVal sender As...
8
by: Eddie | last post by:
Hi All, I just want to change the mouse cursor during a process. I want a hourglass... How may I do it ? Thx
1
by: Stefan Mueller | last post by:
With the following code I can change the mouse pointer. However, if you click in Mozilla (with IE it works perfect) on 'Show hourglass' the mouse pointer changes only if you move the mouse at least...
0
by: haegens | last post by:
I am making a .NET Application which has a TreeView Control in it. I have 3 levels of nodes. The toplevel is a rootnode which contains all other nodes. The second level holds one kind of nodes that...
7
by: Henry Stockbridge | last post by:
Hi, I am running the following code and the visibility of the Hourglass appears late, instead of immediately. Any ideas of how I can remedy this? ============= Private Sub...
3
by: CSharpguy | last post by:
I have 3 drop downs that are populated from the databasem 4 of my web pages need to have this drop down, how can I trap the selection made in the drop down and popuate my grid on my form?
2
by: diatom | last post by:
Hello, I have a custom dialog. When the user hits the 'Ok' button, I want my mouse to turn into an hourglass while its performing work - and then I want it to go back to normal afer the work is...
2
by: Roberto Reale | last post by:
While developing a drag&drop enabled application I found out this "strange" behaviour: if I put a message box into the QueryContinueDrag event handler the message box is shown but the mouse cursor...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.