On Tue, 19 Feb 2008 22:04:30 +0100, Stefan Heinrichsen <[EMAIL PROTECTED]>  
wrote:

> Hello,
>
> when I try to set the onzoom Attribute of the svg-tag via setAttrbuteNS  
> it
> does not works for me. Setting it directly in the file works. This basic
> example:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <svg xmlns:svg="http://www.w3.org/2000/svg";>
>  <script type="text/ecmascript">
> document.getElementsByTagName('svg').item(0).setAttributeNS(null,  
>       'alert("test");');
>  </script>
>      <rect width="200" height="200" x="0" y="0" />
> </svg>
>
>
> I don't get a alert when zooming with this example. Could you tell me if  
> it
> works for me and/or how to fix this?

I suppose the above should be:
  document.getElementsByTagName('svg').item(0).setAttributeNS(null,  
"onzoom", 'alert("test");');

But I find it's usually better to use addEventListener instead:
   document.getElementsByTagName('svg').item(0).addEventListener("SVGZoom",  
function() { alert("test"); }, false);

Additionally some implementations may not find the element until the  
document has loaded fully, so you might want to setup the listener from an  
onload handler to be sure.

Hope this helps
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed


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

<*> 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:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

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