473,405 Members | 2,310 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,405 software developers and data experts.

Changing the cursor dynamically using JavaScript

I have a figure SVG, and i´m trying to on mouseover event, change the cursor style to "hand".

I tried to do this:

var figure= document.embeds['SVG'].getSVGDocument().getElementById(elementId);

figure.style.cursor = "hand";

thanks for the help
Feb 14 '08 #1
11 4346
Try using the keyword 'pointer' instead of 'hand'. This is supposed to be the standard and should work on most browser.

Jon
Feb 14 '08 #2
it doesn´t work...
and the strange thing is that nothing happens...
no error...and no ...pointer or hand
Feb 14 '08 #3
acoder
16,027 Expert Mod 8TB
What's elementid? Which element are you referring to?
Feb 14 '08 #4
elementid refers to the id of the element
and the element is a rect
Feb 14 '08 #5
acoder
16,027 Expert Mod 8TB
I think you may need the root element before calling getElementById as described here.

If that doesn't work, show the corresponding HTML code.
Feb 15 '08 #6
Here is a description of the SVG file:

[HTML]<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="1.1"
baseProfile="full"
id="SVG" image-rendering="optimizeSpeed" width="612" height="800"
viewBox="0 0 612 792" overflow="visible" enable-background="new 0 0 612 792" onload="initSVG()">

<rect id="Planta" x="-70.0" y="60.5" fill="#FFFFFF" width="710" height="655" onclick="onClick(evt)"/>
<g id="Group">
<g id="SmallGroup" onmouseover="ChangeColor(evt)" fill="lightgrey">
<rect id="idRect" name="FigureName" x="408" y="154" fill="silver" width="97" height="5"/>
</g>
</g>
</svg>
[/HTML]

And here is a description of javascript file:

Expand|Select|Wrap|Line Numbers
  1. function ChangeColor(evt)
  2. {
  3.     var elementId = evt.target.getId();
  4.     var figure = document.embeds['SVG'].getSVGDocument().getElementById(elementId);
  5.     figure.setAttribute("opacity",0.25);
  6.  
  7. }
Feb 25 '08 #7
And the opacity works...
So i just want to know how i change the mouse style to "hand" when i pass the mouse over the "rect".

Thanks
Feb 25 '08 #8
where obj = figura in my code;

i have done that...

figura.style.cursor = 'pointer';


and nothing happens...no error and no hand...
Feb 25 '08 #9
gits
5,390 Expert Mod 4TB
where obj = figura in my code;

i have done that...

figura.style.cursor = 'pointer';


and nothing happens...no error and no hand...
just to ensure - i only see figure and no figura in your script?
Feb 25 '08 #10
ok...i have typed wrong here

where obj = figure in my code;

i have done that...

figure.style.cursor = 'pointer';
Feb 25 '08 #11
acoder
16,027 Expert Mod 8TB
Try using setAttribute to set the cursor.
Feb 26 '08 #12

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

Similar topics

1
by: george lewycky | last post by:
Is there someway I can make a parameter or variable of some sort to pass into my PL/SQL cursor shown below to change the value of the date without having to rebuild the package each time?? Can I...
3
by: Geoff Soper | last post by:
I'm trying to dynamically change the cursor of a couple of maps over an image. Basically the image is in an online photo system where there is a rotate mode. In this mode clicking on the left or...
2
by: malbanese | last post by:
I am building an ASP.Net application that occasionaly "stalls" while running a server side process like a large database update. During this tine the user does not get any feedback as to what is...
10
by: Bill H | last post by:
I used a bit of JS on a page that is fairly long and didn't like the way that <A HREF='#' ONCLICK=\"... refreshed the page to the top. Removing the HREF (<A ONCLICK=\"...) solved my...
2
by: Dominic Myers | last post by:
Hi there, wondered if someone could point me to an appropriate tutorial or offer advice on the following problem? I've got a web page which uses lots of divs to position the content of the...
2
by: Jim Frazer | last post by:
Hi, I'm working on an application in C# that will allow the user to create simple CAD drawings on a CEPC system. I would like to be able to change the cursor shape depending on the drawing mode...
7
by: Fabien LE LEZ | last post by:
Hello, I'd like to put, on a web page, a "place" where the user can type a rather long text, with automatic coloring of each word (e.g. a color depending on the number of letters of the word). ...
5
by: mcraven.2 | last post by:
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...
5
by: Mudcat | last post by:
I was trying to design a widget that I could drag and drop anywhere in a frame and then resize by pulling at the edges with the mouse. I have fiddled with several different approaches and came...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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.