W3C home > Mailing lists > Public > www-svg@w3.org > October 2000

does document.getElementId("MyElementId") work?

From: Wu Ping <wupingzj@yahoo.com>
Date: Sun, 1 Oct 2000 13:44:20 -0700 (PDT)
Message-ID: <20001001204420.27562.qmail@web310.mail.yahoo.com>
To: www-svg@w3.org
Dear sir,

I try to use the following code to get the reference
of an element in a svg file, but always get the null
result. Could you give me a tip?

<svg width="100" height="100">
    function MouseClickHandler() {
      var obj;
        obj = document.getElementById('MyElement');
        if (obj == null)
          alert("Obj is a null!");
          obj.setAttribute('r', '20'); 
  <circle id="MyElement" cx="50" cy="50" 
onclick="MouseClickHandler()" r="10"/>

I run it with IE5 and adobe svg viewer.

Thank you in advance!


Do You Yahoo!?
Yahoo! Photos - 35mm Quality Prints, Now Get 15 Free!
Received on Sunday, 1 October 2000 16:44:52 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:46:49 UTC