15/3. feladat megoldása


<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE svg PUBLIC "-//W3//DTD SVG 1.1//EN"
	"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg xmlns= "http://www.w3.org/2000/svg"
     xmlns:xlink= "http://www.w3.org/1999/xlink"
     version="1.1" width="200" height="200">

<script type="text/ecmascript">
<![CDATA[

function szin(s){
	var szin=svgDocument.getElementById("felirat");
	var ujSzin=svgDocument.createTextNode(s);
	szin.replaceChild(ujSzin,szin.getFirstChild());
};

//]]>
</script>

<rect width="80" height="80" x="10" y="10" style="fill: blue;"
      onmouseover="szin('kék')" onmouseout="szin('-')"/>
<rect width="80" height="80" x="110" y="10" style="fill: green;"
      onmouseover="szin('zöld')" onmouseout="szin('-')"/>

<text id="felirat" style="font-family: arial black; text-anchor: middle;"
      x="100" y="150">-</text>

</svg>