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 never seems to work with
scripting.  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.



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