Hi Julie,
Just by a superficial look on your code, you better change:
fill = symbole.getAttribute("fill");
with :
fill = symbole.getAttributeNS(null,"fill");
(Look at http://jwatt.org/svg/authoring/ )
Hope that this will do the job.
Cheers, Samy
--- In [email protected], "jgfa92004" <juliegaut...@...>
wrote:
>
> Hi again,
> Here is an example of code that works under FF2 but not anymore under
> FF3 (and works under IE7).
> Under FF3, the colors change and the checkbox is checked but then
> everything is reverted...
> Thanks for your help.
> Julie
>
> <?xml version="1.0" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG
> 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> <svg stroke-dasharray="none" shape-rendering="auto" onload="init()"
> id="main" font-family="" width="1000.0px" text-rendering="auto" fill-
> opacity="1" contentScriptType="text/ecmascript" color-
> interpolation="auto" color-rendering="auto"
> preserveAspectRatio="xMidYMid meet" font-size="12" viewBox="0 0
> 10000.0 6000.0" fill="black" stroke="" image-rendering="auto" stroke-
> miterlimit="10" zoomAndPan="disable" version="1.0" stroke-
> linecap="square" stroke-linejoin="miter" contentStyleType="text/css"
> font-style="normal" height="600.0px" stroke-width="1" stroke-
> dashoffset="0" font-weight="normal" stroke-opacity="1"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns="http://www.w3.org/2000/svg">
> <defs>
> <!--Symbols for checkboxes-->
> <symbol overflow="visible" preserveAspectRatio="xMidYMid meet"
> id="checkBoxRect">
> <rect x="0" y="0" fill="white" width="100" height="100"
> stroke="dimgrey" stroke-width="15"/>
> </symbol>
> <symbol fill="none" id="checkBoxCross"
> preserveAspectRatio="xMidYMid meet" stroke="dimgrey" stroke-
> width="10" pointer-events="none">
> <line y2="100" x1="0" x2="100" y1="0"/>
> <line y2="0" x1="0" x2="100" y1="100"/>
> </symbol>
> </defs>
> <script type="text/ecmascript">
> <![CDATA[
> function init()
> {
> main = document.getElementById("main");
> carto = document.getElementById("carte");
> }
>
> function inverser()
> {
> alert("flag1");
> for (i=0 ; i<2; i++)
> {
> symbole = document.getElementById("symb" + i);
> fill = symbole.getAttribute("fill");
> fill = fill.substring(4,fill.length - 1);
> color = fill.split(",");
> ancienR = color[0];
> ancienV = color[1];
> ancienB = color[2];
> nouveauR = ancienV;
> nouveauV = ancienR;
> nouveauB = ancienB;
> nouvelleCouleur = "rgb(" + nouveauR + "," + nouveauV + "," + nouveauB
> + ")";
> symbole.setAttributeNS(null,"fill",nouvelleCouleur);
> }
> alert("flag2");
> }
>
> function checkBoxScript(evt,myLayer) {
> var myCheckCrossObj = document.getElementById("cc_"+myLayer);
> var myCheckCrossVisibility = myCheckCrossObj.getAttributeNS
> (null,"visibility");
> if (evt.type == "click" && evt.detail == 1) {
> if (myCheckCrossVisibility == "visible") {
> myCheckCrossObj.setAttributeNS(null,"visibility","hidden");
> }
> else {
> myCheckCrossObj.setAttributeNS(null,"visibility","visible");
> }
> inverser();
> }
> }
> ]]>
> </script>
> <svg width="6000.0px" height="6000.0px" id="carte" viewBox="0 0
> 6000.0 6000.0" preserveAspectRatio="xMidYMid meet"
> xmlns="http://www.w3.org/2000/svg" zoomAndPan="magnify">
> <g id="Fond et carte" >
> <circle fill="rgb(255,0,0)" r="209.40681554472778"
> id="symb0" cx="2762.6117036609976" cy="1515.4799654078988"/>
> <circle fill="rgb(78,255,0)" r="173.20530240219819"
> id="symb1" cx="3086.912654943788" cy="593.9463822427214"/>
> </g>
> </svg>
> <g id="parametres">
> <g id="inversion">
> <a xlink:href="" xlink:type="simple" xlink:actuate="onRequest"
> xlink:show="replace" xmlns:xlink="http://www.w3.org/1999/xlink">
> <g transform="translate(6100 2040)">
> <use onclick="checkBoxScript(evt,'inversion');"
> xlink:type="simple" xlink:actuate="onRequest" id="cb_inversion"
> xlink:show="replace" xlink:href="#checkBoxRect"
> xmlns:xlink="http://www.w3.org/1999/xlink"/>
> <use xlink:type="simple" visibility="hidden"
> xlink:actuate="onRequest" id="cc_inversion" xlink:show="replace"
> xlink:href="#checkBoxCross"
> xmlns:xlink="http://www.w3.org/1999/xlink"/>
> </g>
> </a>
> <text fill="black" x="6250" font-size="100" y="2120" pointer-
> events="none" startOffset="0">inversion des couleurs</text>
> </g>
> </g>
> </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/