473,581 Members | 2,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing the cursor dynamically using JavaScript

28 New Member
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 ().getElementBy Id(elementId);

figure.style.cu rsor = "hand";

thanks for the help
Feb 14 '08 #1
11 4365
clivethebadger
12 New Member
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
guilherme21922
28 New Member
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 Recognized Expert Moderator MVP
What's elementid? Which element are you referring to?
Feb 14 '08 #4
guilherme21922
28 New Member
elementid refers to the id of the element
and the element is a rect
Feb 14 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
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
guilherme21922
28 New Member
Here is a description of the SVG file:

[HTML]<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="ht tp://www.w3.org/1999/xlink"
version="1.1"
baseProfile="fu ll"
id="SVG" image-rendering="opti mizeSpeed" width="612" height="800"
viewBox="0 0 612 792" overflow="visib le" 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="onClic k(evt)"/>
<g id="Group">
<g id="SmallGroup " onmouseover="Ch angeColor(evt)" fill="lightgrey ">
<rect id="idRect" name="FigureNam e" 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
guilherme21922
28 New Member
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
guilherme21922
28 New Member
where obj = figura in my code;

i have done that...

figura.style.cu rsor = 'pointer';


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

i have done that...

figura.style.cu rsor = '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

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

Similar topics

1
8106
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 alter this value dynamically ?? and trx_date > '31/MAR/04' any ideas would be appreciate
3
3436
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 right half of the image rotates it 90 degrees to the left or right. I want to change the cursor to indicate this but only while in the rotate mode....
2
383
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 going on, an is likely to try clicking things multiple times which could result in an unwanted outcome. Is there any way to change the mouse pointer to...
10
2847
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 "problem" however the cursor no longer changes into the little hand when rolling over the link. Can I have both? No HREF and the little hand?
2
1724
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 page and I'm using a nice javascript to alter the css of a table of links. The thing is I don't want the table of links to point to an external site...
2
9027
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 selected by the user. I started out by setting up P/Invokes for LoadCursor and SetCursor. Calling LoadCursor followed by SetCursor does allow me...
7
3834
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). The only solution I could think of is rather ugly: a <textareafor the user to type in, and behind the <textarea>, one <spanfor each word, with the...
5
3143
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 over a drop down?
5
1965
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 across this behavior when using the combination of place() and configure(cursor = ...) This problem doesn't occur if you remove either one of these...
0
7808
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...
0
8312
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...
1
7917
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...
0
8182
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...
0
6567
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...
1
5685
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...
0
3809
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...
1
2311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1147
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...

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.