--- In svg-developers@yahoogroups.com, Holger Jeromin <mailgm...@...> wrote: > > Narendra Sisodiya schrieb am 20.11.2010 05:36: > > On Sat, Nov 20, 2010 at 9:03 AM, Kenneth Nellis <nelli...@...>wrote: > >> I have this SVG file* that displays a centered grid, dimensions > >> 10x10, that scales to the size of the web page. I've attached an > >> "onclick" handler to the grid that displays the x,y coordinates of > >> the click point. I want the coordinates to be of the grid's > >> coordinate system, but I'm getting the coordinates of the web page. > >> I'm hoping someone can advise how to fix this. > >> æen Nellis > >> * http://homepage.mac.com/nellisks/yahoo/groups/svg-developers/ > >> gridClick.svg > > I am using Firefox - > > x = evt.offsetX; is not not giving correct result, > > Error - x is undefined when it is used later > > offsetX is only available in opera, safari, chrome. > layerX is available in safari, chrome, firefox > > clientx is available in all: opera, chrome, safari, firefox and adobe > svg viewer > > pageX is available in all browsers (no adobe plugin) and is independant > from the scrolling. > > > But the problem is still that the offset of > document.getElementById("grid") compared to the page is apparently not > available. This is really suprising to me. I have not found a solution. > > -- > best regards > Holger
Thank you for your response. Another difference I just noticed is that Safari responds to the onclick handler if anywhere in the viewBox is clicked, whereas Firefox and Opera require you to click right on one of the lines, so this is a separate problem to fix. And Opera's responses using offsetX/Y appear to be complete garbage! Anyway, I'm still open to ideas and offer links to the original version (offsetXY) as well as links to versions using clientXY and pageXY. http://tinyurl.com/offsetXY-svg http://tinyurl.com/clientXY-svg http://tinyurl.com/PageXY-svg --Ken Nellis ------------------------------------ ----- To unsubscribe send a message to: svg-developers-unsubscr...@yahoogroups.com -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ----Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/svg-developers/join (Yahoo! ID required) <*> To change settings via email: svg-developers-dig...@yahoogroups.com svg-developers-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: svg-developers-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/