----------------------- Yahoo! Groups Survey ----------------------~--> Please help us to improve Yahoo! Groups. Take the survey now! http://v2.decipherinc.com/survey/yahoo/yah04021?list=2 --------------------------------------------------------------------~->
Hi, guygoye: Does it have to be an external file? Also, I found that I needed to use ecmascript to interact with SVG. I'm copying this line from my O'Reilly SVG Essentials book: You can write a program in ECMA Script (the European Computer Manufacturer's Association standard version of what is commonly called JavaScript) to interact with an SVG graphic. Interaction occurs when graphic objects respond to events. Peter Thompson just solved a problem for me that shows / hides bargraphs. I'll include the code here and you can use it as an example. //////////////////////////////// code below /////////////////////////////////////////// <svg width= "100%" height="100%" viewBox="0 0 900 500" onload="init(evt)" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <script type="text/ecmascript"> <![CDATA[ var offsetY = 50; function init(evt) { refresh(svgDocument.getElementById("tasks") ,0); } function mouseClick(evt) { var obj=evt.target.getNextSibling(); if ((obj != null) && (obj.nodeName=="#text")) { obj=obj.getNextSibling(); // alert("obj = " + obj); // MODIFIED if ((obj != null) && (obj.nodeName=="g")) { var attr = obj.getAttribute("visibility"); if (attr == "hidden") { obj.setAttribute("visibility", ""); } else { obj.setAttribute("visibility", "hidden"); } offsetY = 50; // MODIFIED refresh(svgDocument.getElementById("tasks") ,0) } } } function refresh(objGroup, level) { var layer=objGroup.childNodes; var num=layer.length; for (var ix=0; ix < num; ix++) { var obj=layer.item(ix); if (obj.nodeName == "rect") { offsetX = level * 40; var transform = "translate(" + offsetX + " " + offsetY + ")"; obj.setAttribute("transform", transform); offsetY = offsetY + 30; } else if (obj.nodeName == "g") { if (obj.getAttribute("visibility") != "hidden") { refresh(obj, level+1); } } } } // ]]> </script> <g id="tasks" onclick="mouseClick(evt)"> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <g> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> </g> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <rect x="5" y="5" width="200" height="20" style="fill:yellow"/> <g> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <g> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <g> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> </g> </g> </g> <rect x="5" y="5" width="200" height="20" style="fill:blue"/> <rect x="5" y="5" width="200" height="20" style="fill:red"/> </g> </svg> guygoye <[EMAIL PROTECTED]> wrote: Yahoo! Groups Survey Please help us to improve Yahoo! Groups. Take the survey now! hello!! i'm trying to command a svg with an external javascript. is ti possible? if yes tell me how do it because a beginner !!! thank you guygoye ----- 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 the Yahoo! Terms of Service. [Non-text portions of this message have been removed] ----- 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/