473,666 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DOM cursor issues

1 New Member
This is the first time I've posted a 'help' request, so please be patient.

I've created a DOM web page where with the usage of usemap images on the page change upon rollover using JavaScript. Other than href, is there a way to make the cursor change upon rollover?

Only when a particular area has been clicked on do I wish for others to react to a rollover. This is all done in JS within the same page, and it works - except for the mouse change.

I've tried the following script (embedded within a JS function called upon by a mouseover):

firstCssFile=do cument.styleShe ets[0];
myCssRule=first CssFile.cssRule s? firstCssFile.cs sRules:firstCss File.rules;

myCssRule[0].style.cursor=" pointer";
myCssRule[0].style.cursor=" hand";

In the attached CSS file the first rule (line) is: body {cursor: default;}

Scripted for both platforms, the above function should cause the cursor to change upon mouseover. It works great with IE, but, ironically, not with Safari or FireFox.

However, if I get rid of the usemap in the <img> tag and attach this script directly to a mouseover within the image tag then all works fine. But that defeats the purpose of using imagemaps.

And, oh, when it works from within the <img> tag, FireFox's JS console tells me there's a parsing error with the first rule of the attached CSS file (i.e. the cursor statement.)

Can anyone help me? Does anyone know the solution? I'd be appreciated :)
Feb 22 '06 #1
1 4570
Banfa
9,065 Recognized Expert Moderator Expert
I think I would create a javascript function like this

Expand|Select|Wrap|Line Numbers
  1. function ChangeRollover( id )
  2. {
  3.   var element = document.getElementById( id );
  4.   if ( element )
  5.   {
  6.     element.style.cursor = "pointer";
  7.     element.style.cursor = "hand";
  8.   }
  9. }
  10.  
The difference between my code and your code is that your code trys to directly alter the load CSS file where as mine alters the inline style tags. Because of the way CSS cascades altering the style tags take precedence over what is in the CSS file so this works as a way of changing styles on a given element.

Additionally it is supported cross browser without modification (in theory) because it is part of the HTML DOM.

Call my function with the id of the tag you want to change the cursor for (set using the id attribute).
Feb 23 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
7683
by: Jim | last post by:
I having a difficult time here trying to figure out what to do here. I need a way to scroll through a recordset and display the results with both forward and backward movement on a web page(PHP using ADO/COM).. I know that if I use a client side cursor all the records get shoved to the client everytime that stored procedure is executed..if this database grows big wont that be an issue?.. I know that I can set up a server side cursor...
3
2066
by: jcrouse | last post by:
I have created a form designer type application (with a lot of you peoples helpJ). It has label controls that are draggable at runtime. The user is also allowed to change some properties such as forecolor, backcolor and font. The labels also are rotatable and the text can also be flipped 180 degrees (the flipped text part is still being worked on). I have one context menu for all 30 labels that allows for the property changes to the labels....
0
1014
by: Neal | last post by:
Hi All, Help please Cross browser and W3C issues: Having major hassles trying to get my site working and looking decent in FFox (great in IE), MOzzie support said to try the W3C Validator so I submitted the following Markup to http://validator.w3.org/check and got This page is not Valid HTML 4.0 Transitional!
0
1580
by: Lou | last post by:
Dear all, I have two questions and need to get some hints from u. :0) 1. Editor with the syntax functionality. In my ongoing editor, when the user types the word, e.g. "ABC", the word "ABC" will appear in the RichTextBox with the changed color red. Afterwards, when the furhter action is taking on, e.g. user gives the input directly in the RichTextBox or types the other word, the color
1
7510
by: peaceburn | last post by:
Hi, I'm gonna pull my hair in the coming days with these DB2 stored procedures. So the issue, let's assume a simple stored procedure like this : CREATE PROCEDURE MYSCHEMA.PROCEDURE1 ( ) DYNAMIC RESULT SETS 1 ------------------------------------------------------------------------
4
64868
by: Brandon McCombs | last post by:
Does anyone know of an easy way to set the position of the cursor in a TextBox? If I set text in the box that is longer than the length of the TextBox the position of the cursor is at the very end of the line and a user would have to use the arrow keys to move it back to the beginning of the line of text. I'd prefer to set the cursor position automatically to just before the first character of the text. thanks
26
2522
by: Prisoner at War | last post by:
Hello, Everyone: Is there any other values or whatever-it's-called to the cursor property in CSS?? So far, I only know of cursor:pointer (or, for MSIE, cursor:hand).... Any way to load in one's own somehow?? Just a noob at this...TIA!!
0
2815
by: senthiltkp | last post by:
Hi, I'm new to DB2 and have little knowledge on database. i'm facing a Spin lock issue in db2.. Thread here am talking is Java thread..(Sepearte process) The spin Lock is acquired to ensure Same thread Can’t be stated again. In our Application each thread is mapped to row .So lock is acquired on a row.
3
2280
by: jrod11 | last post by:
Hi everyone, I'm working on creating a company intranet or my company and having trouble with IE. I have a navigation bar at the bottom of my page that is a quick links bar and is a fixed position. the background image is a .jpg. Depending on the computer, the background image will appear or not show up at all. The weird part is that the SAME version of IE 8 will show it on one computer, but another computer that has IE 8 will not. I...
0
8355
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
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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...
1
8550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7381
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...
1
6191
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4193
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...
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
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.