Thanks Holger,

did the trick

what i was trying to originally was after the <animate> element was 
added then to run the animation

I was using  
   a.setAttribute("begin", "indefinite");

and then sending 
   document.getElementById('anim2').beginElement()

but I'm guessing this beginElement() is sent too soon afte the 
appendChild so that it doesn't actualy function - it can begin 
something that doesn;'t yet exist!!!

if I hold the begineElement() call back with setInterval it works as 
intened, but this is cludgy!!!

Thanks again




--- In svg-developers@yahoogroups.com, Holger Will <[EMAIL PROTECTED]> 
wrote:
> gh_urban schrieb:
> 
> > tottaly bemused by this
> >
> > I have looked at the many answers already on this group,
> >
> > hacked my code to exactly as some of the final answers
> >
> > still no joy, anybody see what's wrong with it?
> >
> > here's the code:
> >
> >       function aniBtn(){
> >       //create a reference for the object that wants animating
> >       var obj = document.getElementById('bt1');
> >                  
> >       //create a new 'animate' element
> >       var a = document.createElement("animate");
> >                  
> >       //now set the attributes
> >       a.setAttribute("id","anim2");
> >       a.setAttribute("begin", "indefinite");
> >       a.setAttribute("attributeName","width");
> >       a.setAttribute("from","0");
> >       a.setAttribute("to","80");
> >       a.setAttribute("dur","1s");
> >                                    
> >       // add the element to the
> >       obj.appendChild(a);
> >                  
> >       //add onclick to the object to start the anim
> >       //(and an alert() to see if it completes)
> >       obj.setAttribute("onclick","document.getElementById
> > ('anim2').beginElement();alert('should have recieved the
> > beginElement');");
> >       }
> >
> >
> Hi
> 
> use addEventListener instead of setAttribute("onclick",...)
>  so instead of:
>     
> obj.setAttribute("onclick","document.getElementById
('anim2').beginElement();");
> do this:
>  obj.addEventListener("click",function 
> (){document.getElementById('anim2').beginElement();},false)
> 
> you could also just comment out  this line , and do
> a.setAttribute("begin","click")
> which has the same effect.
> 
> hth
> Holger




-----
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