473,756 Members | 4,256 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.leng th;i++)
{
doc(i).style.cu rsor = 'wait';
}

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

Jul 22 '06 #1
5 3153
mc*******@wrigh t.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.getEle mentsByTagName 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.leng th;i++)
{
doc(i).style.cu rsor = '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.ne t.auwrote:
>mc*******@wrig ht.edu wrote:
>for (i=0;i<doc.leng th;i++)
{
doc(i).style.cu rsor = '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.ne t.auwrote:
>mc*******@wrigh t.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.toL owerCase()){
tgt.style.curso r = 'wait';
} else {
tgt.style.curso r = 'normal';
}
}
}

</script>

<body onmouseover="do Wait(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.ne t.auwrote:
mc*******@wrigh t.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.toL owerCase()){
tgt.style.curso r = 'wait';
} else {
tgt.style.curso r = 'normal';
}
}
}

</script>

<body onmouseover="do Wait(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(P aram1)
{
document.body.s tyle.cursor = Param1
}

</script>

<body>

<a href="#" onclick="Change _Cursor('wait') ">Change Cursor to
Wait</a><br>
<a href="#" onclick="Change _Cursor('pointe r')">Change Cursor to
Pointer</a><br>
<a href="#" onclick="Change _Cursor('defaul t')">Change Cursor to
Default</a><br>

<form>
<select>
<option>ABCDFEG HIJKLMNO</opion>
<option>PQRSTUV WXYZ1234</opion>
<option>567890A BCDFEGHI</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*******@wrigh t.edu wrote:
I know this works on all objects except drop down boxes.

doc = document.all
for (i=0;i<doc.leng th;i++)
{
doc(i).style.cu rsor = '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
1563
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 USENET...get rewarded for it!
9
4900
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 System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.Cursor = Cursors.WaitCursor Textbox1.text = Now.Tostring System.Threading.Thread.Sleep(2000) ' 2 second wait
8
16995
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
4183
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 on pixel. <html> <body> <script type = 'text/javascript'> function show_hourglass() { document.getElementById("my_href1").style.cursor = "wait"; document.getElementById("my_href2").style.cursor = "wait";
0
2526
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 have one type of objects assigned to the tag property. The third level holds another kind of nodes. Also this level has one type of objects assigned to the tag property. The objects that are assigned in the third level nodes, are child objects of...
7
4282
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 lblUpdateMDList_Click()
3
1472
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
16304
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 finished. In C# and Windows projects, how I can I control the look of the mouse? Thanks
2
2720
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 is set to WaitCursor (Hourglass) and I can't click on OK or on X, so that the only way to close the message box is via the keyboard, by pressing SPACE key. The most strange thing is that if I place two message boxes, only the first one is...
0
9462
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9886
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9722
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6542
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.