Source du fichier SVG

<svg width="400" height="200" onload="cree_event(evt)">
<script><![CDATA[
function alerte()
{alert("Vous etes passe")}
function cree_event(evt)
{svgdoc=evt.getTarget().getOwnerDocument();
node=svgdoc.createElement("rect");
node.setAttribute("x","50");node.setAttribute("y","50");
node.setAttribute("width","100");node.setAttribute("height","50");
node.setAttribute("style","fill:red");
node.addEventListener("mousemove",alerte,false);
ou=svgdoc.getElementById("affiche");
ou.appendChild(node)}
]]></script>
<g id="affiche">
<text x="100" y="20" style="text-anchor:middle;font-size:15;font-family:Arial;fill:red">Passez sur le rectangle rouge</text>
</g>
</svg>