I think andré is correct. But when the event handler is a group, one might expect the group id to be returned. Instead (at least in dragging things around) I had to pass the group id as a parameter.
In http://srufaculty.sru.edu/david.dailey/svg/drag4.svg (which works in either IE/ASV3 or Firefox 1.5 gamma?) I did something like function trap(evt,id){ if (arguments.length==1) id=evt.target.id ... } so that if the second argument didn't exist I would fill it in as the target of the event. But in the case of groups I found that whichever object within the group actually received the event, its id was returned even though the event listener was assigned to the group. I suspect somebody has a better solution, but I may have been sleeping the last time events and groups were discussed. In the meantime I contemplated finding which id was returned then checking to see if that id has a parent who happens to be a group, but that made me sleepy again. David At 12:33 PM 11/11/2005, andréwrote: >alert(elementdata[evt.target.getAttributeNS(null,'id')]); > >andré > >brunertodd wrote: > > Apologies in advance for a stupid question that so far has resisted > > "googling." > > > > I wish to know the "Id" value for a node that has been clicked. for > > example: > > > > <g id="mybox" onclick="printData(evt)"> > > <polygon points="4,0 0,0 0,4 4,0" /> > > <g> > > > > where the javascript section would look like > > > > elementdata["mybox"] = "Long winded description number 1"; > > elementdata["yourbox"] = "Another description. Yea!"; > > > > function printData(evt) { > > var element = evt.target; > > var idvalue = ????????? // dom method? > > alert(elementdata[idvalue]); > > } > > > > I know that element is the object, but I need to tie to some data > > outside the element's attributes that is indexed by the Id, in this > > case "mybox". > > > > so I want the alert box to display "Long winded description number 1" > > when the "mybox" svg object is clicked. But I don't know a way to set > > the idvalue variable to the id of the <g>. > > > > Thanks for your help! > > > > Todd > > > > > > > > > > > > > > ----- > > To unsubscribe send a message to: > [EMAIL PROTECTED] > > -or- > > visit > http://groups.yahoo.com/group/svg-developers and click "edit my membership" > > ---- > > Yahoo! Groups Links > > > > > > > > > > > > > > > > > > >-- >___________________________________________________________________ >andre m. winter, > cartography for internet and multimedia applications > schiessstand 4/1, a6091 goetzens, tyrol, austria > tel.: ++43.5234.32732 > email: <[EMAIL PROTECTED]> > ><http://www.vectoreal.com/> SVG consulting and development ><http://www.carto.net/> online cartography focusing on SVG ><http://www.carto.at/> print and online touristic map solutions > > > > > >----- >To unsubscribe send a message to: [EMAIL PROTECTED] >-or- >visit >http://groups.yahoo.com/group/svg-developers and click "edit my membership" >---- >Yahoo! Groups Links > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -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/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

