Hi! I want to count all the circles that are blue when pressing the enter key. They become blue when I click on them (before this they were red). But when I jump to my function and write out the colours its red not blue. And so the count is 0. Why? This is the code:
<?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 width="1000" xmlns:xlink="http://www.w3.org/1999/xlink" cursor="auto" height="800" id="svg" xmlns="http://www.w3.org/2000/svg" onload="addKeyListener(evt)"> <!-- Javascript --> <defs> <script type="text/javascript"><![CDATA[ function addKeyListener(evt) { var elem = evt.target; svgdoc = elem.ownerDocument; svgroot=svgdoc.rootElement; svgroot.addEventListener("keypress",Key,false); } function Key(evt) { var keynum=evt.charCode; var keychar=String.fromCharCode(keynum); var svgdoc = evt.target.ownerDocument; if (keynum==13) // ENTER key!!! { var circles = svgdoc.getElementsByTagName("circle"); var marked=0; for (var i=0;i<circles.length;i++) { var el = circles.item(i); alert(el.getAttribute("fill")); if (el.getAttribute("fill") == "blue") { marked++; } } alert(marked); } } ]]> </script> </defs> <circle r="40" id="circ1" fill="red" cx="20" cy="20"> <set attributeName="fill" to="blue" begin="click" dur="indefinite"/></circle> <circle r="40" id="circ2" fill="red" cx="200" cy="20"> <set attributeName="fill" to="blue" begin="click" dur="indefinite"/></circle> <circle r="40" id="circ3" fill="red" cx="300" cy="20"> <set attributeName="fill" to="blue" begin="click" dur="indefinite"/></circle> </svg> Please help me! tam ----- 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/ <*> 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/

