I have prepared the following test code and, following the advise provided by Erik Dahlstrom, I am using one of his suggestions ---function conmuta4()--- in my production code
<?xml version='1.0' encoding='utf-8' standalone='no' ?> <svg xmlns:xlink='http://www.w3.org/1999/xlink' xmlns='http://www.w3.org/2000/svg' version='1.1' viewBox='0 0 1024 768' width='100%' height='100%' preserveAspectRatio='none'> <script type='text/javascript'> var n = 0; // This images should be available on same directory! var imagen = ['barco.jpg', 'croc1.jpg']; // Works on IE, FF, Chrome, Safari function conmuta1() { n = 1 - n; var imagen1 = document.getElementById("1.image"); imagen1.setAttribute("xlink:href", imagen[n]); } // Works on IE, FF, Opera, Chrome, Safari function conmuta2() { var imagen2a = document.getElementById("2a.image"); var imagen2b = document.getElementById("2b.image"); var att2a = imagen2a.getAttribute("display"); var att2b = imagen2b.getAttribute("display"); imagen2a.setAttribute("display", att2b); imagen2b.setAttribute("display", att2a); } // Works on FF, Opera, Chrome, Safari function conmuta3() { n = 1 - n; var imagen1 = document.getElementById("1.image"); imagen1.href.baseVal = imagen[n]; } // Works on IE, FF, Opera, Chrome, Safari function conmuta4() { n = 1 - n; var imagen1 = document.getElementById("1.image"); imagen1.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", imagen[n]); } </script> <rect width="10" height="10" fill="red" onclick="conmuta1();" /> <rect x="20" width="10" height="10" fill="red" onclick="conmuta2();" /> <rect x="40" width="10" height="10" fill="red" onclick="conmuta3();" /> <rect x="60" width="10" height="10" fill="red" onclick="conmuta4();" /> <image x="0" y="200" id="1.image" width="60" height="60" viewBox="0 0 60 60" preserveAspectRatio="none" xlink:href="barco.jpg" xmlns:xlink="http://www.w3.org/1999/xlink" /> <image display="inherit" x="200" y="200" id="2a.image" width="60" height="60" viewBox="0 0 60 60" preserveAspectRatio="none" xlink:href="barco.jpg" xmlns:xlink="http://www.w3.org/1999/xlink" /> <image display="none" x="200" y="200" id="2b.image" width="60" height="60" viewBox="0 0 60 60" preserveAspectRatio="none" xlink:href="croc1.jpg" xmlns:xlink="http://www.w3.org/1999/xlink" /> </svg> ------------------------------------ ----- 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/