SVG Prototype
This is a quick prototype of dynamic SVG stuff that I want to use for some other projects. It's mostly left here so I can send it to people who want to see what it looks like.
Here's the image:
And here's the code:
<svg height="200" id="diagram" width="250" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg">
<text id="commbox" x="0%" y="85%">This is RED and GREEN.</text>
<circle cx="50" cy="50" fill="red" id="circle1"
onmouseout="evt.target.setAttribute('fill','red');Txt('This is RED and GREEN.')"
onmouseover="evt.target.setAttribute('fill', 'blue');Txt('This is BLUE and GREEN.');"
r="20"></circle>
<circle cx="150" cy="50" fill="green" id="circle2"
onmouseout="evt.target.setAttribute('fill','green');Txt('This is RED and GREEN.')"
onmouseover="evt.target.setAttribute('fill', 'blue');Txt('This is RED and BLUE.')"
r="20"></circle>
<script>
function Txt(txt_in){
document.getElementById("commbox").textContent=txt_in;
}
</script>
</svg>
It's fairly simple, but designed to achieve some nice interactivity. -MC
Comments
Post a Comment