Here is what I have:

<?xml version="1.0" encoding="UTF-8" ?>

<svg xmlns="http://www.w3.org/2000/svg";
     xmlns:svg="http://www.w3.org/2000/svg";
     xmlns:xlink="http://www.w3.org/1999/xlink";
     width="101" height="101">

<script type="text/ecmascript" >
    function changeRect(rectName) {
        var useElem = document.getElementById('useElem');
        if (useElem.getAttribute('href') != null) {
            document.getElementById('useElem').setAttribute('href','#' +
rectName);
        }
        else if (useElem.getAttribute('xlink:href') != null) {
            document.getElementById('useElem').setAttribute('xlink:href','#'
+ rectName);
        }
    }
</script>

<defs>
    <rect id="rect1" x="1" y="1" width="50" height="50" stroke="green"
fill="green" onclick="changeRect('rect2')" />
    <rect id="rect2" x="1" y="1" width="50" height="50" stroke="red"
fill="red" onclick="changeRect('rect1')" />
</defs>

<use id="useElem" xlink:href="#rect1" />

</svg>

This works in FireFox and Opera.  IE is and always will be pure crap, so
that doesn't matter.  In fact, the reason I even care to use Batik is that I
want to ensure that I can use this in every browser through an applet. 
However, this SVG doesn't work in Squiggle.  I played around and found that
I can put JS calls into the <use> element, but any of the JS calls within
the defs won't be run.  I need different objects to produce unique results. 
Such as this example: both do call changeRect(), but each supplies a
different name to be used in the function.  If I can only make the call from
the <use> element, then I cannot specify what to feed the parameters such
that it relates to the currently displayed object.  If there is a work
around for, I would like to know.  If not, this renders Batik/Squiggle
completely useless for me.
-- 
View this message in context: 
http://www.nabble.com/onclick-within-defs-tf3810944.html#a10786685
Sent from the Batik - Users mailing list archive at Nabble.com.


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

Reply via email to