Sean,

Of course it's possible. You need to target the document and not 
just the element that makes the call:

function edit2(evt){
//      var objet=evt.target;
        var objet = evt.target.ownerDocument;
        var tspan1 = objet.getElementById("tspan1"); //Works
        tspan1.firstChild.data = "NewText";
}

It works in IE7 and FF. I'm not sure the last line is what you want 
to do, just a guess, but tspan1 returns an object so you can do 
anything with it.

Domenico


--- In svg-developers@yahoogroups.com, Jeff Rafter <[EMAIL PROTECTED]> wrote:
>
> 
> Sean,
> 
> It can be done, it just has to be done differently in each 
browser. Try 
> this code inside of your event:
> 
>          var target = evt.target;
>       var use = null
>          if (target == null) return;
>          if (target.correspondingUseElement)
>            use = target.correspondingUseElement;
> 
> This is a sure way to get the <use> element from the target (in 
case it 
> is not correctly returned as an SVGElementInstance). The 
> correspondingElement property is not itself reliable (because of 
> inconsitent implementation interpretations). Once you have that 
you 
> should be able to access
> 
>       use.instanceRoot, use.animatedInstanceRoot (less reliable)
> 
>  From that you should get a reliable SVGElementInstance on which 
you can 
> use the correspondingElement property. Additionally you should be 
able 
> to use read only DOM properties. See
> 
> http://www.w3.org/TR/SVG/struct.html#InterfaceSVGElementInstance
> 
> Also, once you have the <use> element, you can simply follow the 
link 
> specified in the URI reference or simply lookup the referenced 
element 
> by the specified ID.
> 
> Cheers,
> Jeff Rafter
> 
> Sean wrote:
> > I can get the use tag, I want to be able to navigate the use 
tag.  I 
> > have the use referencing a g tag with several elements under the 
g tag.  
> > I want to be able to navigate those elements.  I'm coming to the 
> > conclusion that it can't be done.
> > 
> > Sean
> > 
> > Peter Kalev wrote:
> > 
> >> Why don't you wrap the use element in a <g id="____">, search 
for the
> >> "g" and then look for the <use> inside the "g"... Works fine 
for me...
> >>
> >> Peter Kalev
> >> Senior Developer,
> >> SWF, LLC
> >>
> >>
> >> -----Original Message-----
> >> From: Sean [mailto:[EMAIL PROTECTED] 
> >> Sent: Wednesday, February 08, 2006 11:21 AM
> >> To: svg-developers@yahoogroups.com
> >> Subject: Re: [svg-developers] Re: use tag and unique IDs
> >>
> >> I should say navigate the use element.  I realize that it is 
read only, 
> >> but I can't figure out how to do that.  Thanks.
> >>
> >> Sean wrote:
> >>
> >>  
> >>
> >>> Does any one have examples of using SVGUseElement & 
SVGElementInstance?
> >>>    
> >>>
> >>  
> >>
> >>> Thanks.
> >>>
> >>> Sean
> >>>
> >>> Sean wrote:
> >>>
> >>>
> >>>
> >>>    
> >>>
> >>>> Hi Alastair,
> >>>>
> >>>> Thanks for the input.  I figured as much with the id, but 
> >>>> getElementByName didn't work either.  I was hoping that 
something
> >>>>      
> >>>>
> >> would 
> >>  
> >>
> >>>> work.  I tried the childNodes and firstChild, but nothing 
works.  
> >>>> objet.childNodes.length returns 0, which appears to mean that 
the
> >>>>      
> >>>>
> >> child 
> >>  
> >>
> >>>> nodes under the use tag don't get recognized, rendering the 
approaches
> >>>>      
> >>>>
> >>  
> >>
> >>>> below useless, no pun intended.  My failure to get the use 
tags to
> >>>>      
> >>>>
> >> work 
> >>  
> >>
> >>>> would mean the difference between using 35,000 tags and 
210,000 tags.
> >>>>      
> >>>>
> >> I 
> >>  
> >>
> >>>> have quite the incentive to make it work.  Thanks.
> >>>>
> >>>> var objet=evt.target;
> >>>> alert(objet.childNodes.length);
> >>>>
> >>>> var child = objet.firstChild;
> >>>> i=0;
> >>>> while(child != null){
> >>>> childSibling = child.nextSibling;
> >>>> alert(child.nodeType);
> >>>> child = childSibling;
> >>>> }
> >>>>
> >>>> Sean
> >>>>
> >>>> Alastair Fettes wrote:
> >>>>
> >>>>
> >>>>
> >>>>   
> >>>>
> >>>>      
> >>>>
> >>>>> You've made a fundamental mistake.  
> >>>>>
> >>>>> 1.  The idea behind a defs section is to resuse (have 
multiple
> >>>>>        
> >>>>>
> >> copies)
> >>  
> >>
> >>>>> of an definition.
> >>>>> 2.  The idea of an ID attribute is to only have one 
attribute with a
> >>>>> specific value document wide (see xs:ID type -
> >>>>> <http://www.w3.org/TR/xmlschema-2/#ID>).
> >>>>>
> >>>>> So therefore you have a fundamental mistake.  The defs 
section and
> >>>>>        
> >>>>>
> >> the
> >>  
> >>
> >>>>> id invalidate each other.
> >>>>>
> >>>>> The only thing you could (possibly) do would be to 
getElementById(
> >>>>> "useFrame2" ).childNodes.foo.bar to get the tspan.  Maybe, i 
don't
> >>>>> guarantee it.
> >>>>>
> >>>>> Alastair
> >>>>>
> >>>>> --- In svg-developers@yahoogroups.com, Sean <scene@> wrote:
> >>>>>
> >>>>>
> >>>>>  
> >>>>>
> >>>>>     
> >>>>>
> >>>>>        
> >>>>>
> >>>>>> I would like to use the use tags to save much text size as 
below.  
> >>>>>> Problem is grabbing and editing data with onclick events.  
The id
> >>>>>>
> >>>>>>
> >>>>>>    
> >>>>>>
> >>>>>>       
> >>>>>>
> >>>>>>          
> >>>>>>
> >>>>> for my 
> >>>>>
> >>>>>
> >>>>>  
> >>>>>
> >>>>>     
> >>>>>
> >>>>>        
> >>>>>
> >>>>>> tspan would always be the same, but they would be used in 
different
> >>>>>>          
> >>>>>>
> >> use 
> >>  
> >>
> >>>>>> tags with unique IDs.  Is there a way to isolate say the 
tspan1
> >>>>>>          
> >>>>>>
> >> under 
> >>  
> >>
> >>>>>> useFrame2?
> >>>>>>
> >>>>>> SVG
> >>>>>> <defs>
> >>>>>> <g id="textFrame" cat="textBox">
> >>>>>> <text cat="textBox" font-size="14" font="sans-serif" 
><tspan 
> >>>>>> id="tspan1" cat="textBox">Text</tspan></text>
> >>>>>> <text><tspan visibility="hidden" id="tspan2"></tspan></text>
> >>>>>> </g>
> >>>>>> </defs>
> >>>>>> <use id="useFrame" onclick="edit2(evt);" 
xlink:href="#textFrame" 
> >>>>>> transform="translate(10,25)"/>
> >>>>>> <use id="useFrame2" onclick="edit2(evt);" 
xlink:href="#textFrame" 
> >>>>>> transform="translate(10,50)"/>
> >>>>>>
> >>>>>> JS
> >>>>>> function edit2(evt){
> >>>>>> var objet=evt.target;
> >>>>>> var tspan1 = objet.getElementById("tspan1"); //Doesn't work
> >>>>>> }
> >>>>>>
> >>>>>> Thanks!
> >>>>>>
> >>>>>> Sean
> >>>>>>
> >>>>>> -- 
> >>>>>> "I'd rather have a bottle in front of me, than a frontal 
lobotomy."
> >>>>>> -- Tom Waits
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>    
> >>>>>>
> >>>>>>       
> >>>>>>
> >>>>>>          
> >>>>>>
> >>>>> -----
> >>>>> 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 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/
 



Reply via email to