473,387 Members | 1,416 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,387 software developers and data experts.

What is the mouse?

I'm probably just blanking today, but, how can I find
out what type the cursor currently is? Is
document.activeElement.style.cursor the way to go on this?
But that's only for IE, right?

Thanks for any tips on this,
Csaba Gabor from New York
Jul 20 '05 #1
1 2342
"Csaba2000" <ne**@CsabaGabor.com> writes:
I'm probably just blanking today, but, how can I find
out what type the cursor currently is?
It's hard.
Is document.activeElement.style.cursor the way to go on this?
Not the "style" element, but "currentStyle" in IE will give the
current style of the object. "activeElement"
But that's only for IE, right?


Right. Same for "activeElement". The standard-based method should
work in Mozilla and Opera 7.2, so if we combine the two, we get:

function getCurrentStyle(elem,prop) {
if (elem.currentStyle) {
return elem.currentStyle[prop];
} else {
var cstyle = document.defaultView.getComputedStyle(elem,null);
return cstyle[prop];
}
}

If you can then find the element that the mouse points to (probably inside
a mouse event handler), then you can use the above to find the cursor:

var cursor = getCurrentStyle(elem,"cursor");

What you can use it for is another question. Mozilla and IE reported "auto",
while Opera 7.2 said "default". Neither Mozilla nor IE changed their opinion
just because I hoovered over an element with a ":hover{cursor:text}" rule.
They both said "auto" anyway. Opera 7.2 did say "text".

Good luck.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

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

Similar topics

3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
2
by: George Hester | last post by:
This question is specific to Microsoft Internet Explorer 5 +. I have an input box that gets the focus when the page loads. Using a suggestion earlier here I have re-written the code better. At...
8
by: ilPostino | last post by:
This question is for long term coders hense the extra posting on c# ;) I find coding for long periods and on big projects frustrating when trying to use keyboard AND mouse. Do any of you use just...
5
by: gsb | last post by:
I track the mouse location like this code: function mousePos(e) { var p = new Object(); if(e) { p.x = e.pageX; p.y = e.pageY; } else { p.x = event.x; p.y = event.y; } ... (show) }...
3
by: red | last post by:
mouse events when the mouse is on a "child control" hi everyone; my problem: I have a userControl in this usercontrol, I have a child control (a button) when the mouse moves over the...
1
by: Salad | last post by:
I bought a MS Standard Wireless Optical Mouse, ver 3.0 today and I have a question about it. The question is...do you leave the batteries in until they die? Does the red light stay on until the...
3
by: Emjay | last post by:
Newbie needs to know how to set the mouse position.
21
by: StriderBob | last post by:
Situation : FormX is mdi child form containing 2 ListViews ListView1 contains a list of table names and 4 sub items with data about each table. ListView2 contains a list of the columns on each...
5
by: garyusenet | last post by:
I understand that Point is an object used for storing co-ordinates, such as mouse location. I can't figure out what the e's do in the above example can someone explain please. Thanks, Gary.
2
by: markszlazak | last post by:
In the following script, a control displays (black box) in each table cell once you mouse over the cell. Mouse down on the control to change the mode of the table. Drag the mouse over cells in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.