Thanks Cameron,

The onload for svg element is working so I will use it to add 
DOMCharacterDataModified listeners to other elements.

The other elements have variable ids so I need to follow this approach
to wait till svg is loaded.


Nirmesh.


-----Original Message-----
From: Cameron McCormack [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 16, 2008 4:21 PM
To: batik-users@xmlgraphics.apache.org
Subject: Re: svg event on text value change

Hi Nirmesh.

Nirmesh Desai:
> Is there a place where I can add this listener to appropriate nodes?
> 
> Currently onload throws error in batik saying the function not found.

Here’s an example:

<svg xmlns='http://www.w3.org/2000/svg' width='400' height='300' font-size='18'>
  <title id='title'>Initial title</title>
  <text x='20' y='30'>Document title: “<tspan id='t'> </tspan>”</text>
  <rect x='20' y='60' width='30' height='30'
        onclick='title.firstChild.nodeValue = "Hello!"'/>
  <text x='60' y='80'>← click to change title</text>
  <script>
    var title = document.getElementById('title');
    var t = document.getElementById('t');
    function update(evt) {
      t.firstChild.nodeValue = title.firstChild.nodeValue;
    }
    title.addEventListener('DOMCharacterDataModified', update, false);
    update();
  </script>
</svg>

-- 
Cameron McCormack ≝ http://mcc.id.au/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to