Dear Thomas, Thank you very much for your timely reply. But I still have the problem with displaying dynamically generated elements. Please take a look at the following example. When I click on the circle, I can modify the attribute of circle "c1", but the circle created in the Ecmascript function won't be displayed. How could I get it displayed?
Thanks a lot. Best regards, William <?xml version="1.0"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> <svg width="400px" height="250px"> <script type="text/ecmascript"> <![CDATA[ function createShape(evt) { var svgDoc = evt.getTarget().getOwnerDocument(); var svgRoot = svgDoc.getDocumentElement(); var myShape; myShape = svgDoc.createElement("circle"); myShape.setAttribute("cx", 125); myShape.setAttribute("cy", 125); myShape.setAttribute("r", 50); myShape.setAttribute("style", "fill:#FFCCCC; stroke:#FF0000"); svgRoot.appendChild(myShape); var myShape2 = svgDoc.getElementById("c1"); myShape2.setAttribute("style", "fill:#FFFFFF; stroke:#000000"); } ]]> </script> <circle id="c1" cx="60px" cy="100px" r="50px" style="fill:white;stroke:red;stroke-width:4" onclick="createShape(evt)"/> </svg> -----Original Message----- From: Thomas E Deweese [mailto:[EMAIL PROTECTED]] Sent: Monday, January 06, 2003 7:47 AM To: Batik Users Subject: RE: Question about JavaScript and JSVGCanvas interactivity >>>>> "WH" == William Huang <[EMAIL PROTECTED]> writes: WH> My long term goal is to make dynamic updatable SVG and HTML WH> displayed on JSVGCanvas using JavaScript, SMIL tags, and Batik WH> event model. I can use Javascript to modify the DOM tree, thus I WH> can create a new node. But I failed to display the updated DOM WH> tree on the JSVGCanvas. As I read from Batik CVS, Batik currently WH> does not support dynamic update, the only way to see the update is WH> to call the setDocument on JSVGCanvas to see the update of the WH> whole SVG file. Since I am modifying the DOM in Javascript, how WH> could I call the JSVGCanvas update in JavaScript? Does Batik WH> currently support update to individual components for better WH> interactivity? If you are using Batik 1.5b4 you should be getting automatic updates - 1.5 will not include SMIL support. Batik 1.1.1 does not support dynamic updates. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
