Salve ragazzi,
sto avendo dei problemi a manipolare il dom svg tramite script per poter inserire degli elementi a runtime.
Ho seguito anche la guida su questo sito che riporta quanto segue:
Be sul mio browser ff3 non funziona...cosa manca?codice:<svg id="elementoRadice" width="300" height="300" onload="aggiungiRect()"> <script type="text/ecmascript"><![CDATA[ function aggiungiRect(){ var svgdoc=document.getElementById("elementoRadice"); var newrect=document.createElement("rect"); newrect.setAttribute("x",10); newrect.setAttribute("y",150); newrect.setAttribute("width",250); newrect.setAttribute("height",100); newrect.setAttribute("style","fill:blue;stroke:black;stroke_width:2;"); svgdoc.appendChild(newrect); } ]]></script> <rect x="10" y="10" width="250" height="100" style="stroke:black;fill:red;stroke_width:2"/> </svg>
Nota: gli elementi svg inseriti staticamente nel documento vengono visualizzati correttamente.

Rispondi quotando
