Loading ...
Sorry, an error occurred while loading the content.
 

Changing SVG SRC via onclick in SVG

Expand Messages
  • yahoo@perceive.net
    ...
    Message 1 of 1 , Oct 31 8:39 AM
      I have the following code:


      ---- start SVG ----
      <svg width="600" height="300" xmlns="http://www.w3.org/2000/svg"
      xmlns:xlink="http://www.w3.org/1999/xlink">

      <script type="text/javascript"><![CDATA[
      function refocus(evt) {
      var person=evt.target;
      document.location.href("tree.asp");
      }
      ]]></script>

      <rect id="{@id}" x="120" rx="6px" ry="6px" width="110" height="40"
      fill="{$person_fill}" stroke="black" stroke-width="2" onclick="refocus
      (evt)"/>
      </svg>

      ---end SVG ---

      basically, I want the onclick event for the <rect> to fire the
      function, which will change the src of the SVG. this SVG is being
      inserted into HTML, via <embed>.

      any way to do this?

      --Eric
    Your message has been successfully submitted and would be delivered to recipients shortly.