xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: onclick within defs
Date Sat, 02 Jun 2007 12:05:59 GMT
Hi Otasyn,

Otasyn <otasyn@gmail.com> wrote on 05/24/2007 11:39:53 AM:

> <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);
>         }

    If you are trying to set the 'href' attribute in the
xlink namespace (and you are) this is wrong according to the DOM spec.
You want to use something like:

var xlinkns = "http://www.w3.org/1999/xlink";

 document.getElementById('useElem').setAttributeNS(xlinkns, "xlink:href", 
"#"+rectName);

> This works in FireFox and Opera.

   The above should work in FF and Opera otherwise they are totally
broken and I don't think they are.



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message