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/