473,708 Members | 2,415 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 4378
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
8120
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
3449
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. After looking at it in the Mozilla DOM inspector it seems as if the style is changing but neither...
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 an hourglass or other such icon to signal the user that the request is being processed? Thanks ...
10
2880
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
1742
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 but to calla function which will replace the content of a layer... perhaps it's be better if I...
2
9049
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 to change to a different cursor, such as the cross cursor, but as soon as the application leaves...
7
3856
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 same text and font, and a colored background. I've put it there:...
5
3149
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
1975
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 elements. It's a very basic design of a button wrapped in a sizer frame and is supposed to work like...
0
8788
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
8697
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
9290
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
9001
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...
1
6615
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
5939
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
4454
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
4713
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2097
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.