You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdegraphics/ksvg/test/ecma/circle.svg

39 lines
1.2 KiB

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg width="6cm" height="5cm" viewBox="0 0 600 500" onload="foobar(evt)">
<script type="text/ecmascript"> <![CDATA[
function foobar(evt)
{
var circle = evt.getTarget().ownerDocument.getElementById('moo');
var id = circle.id; // Should call SVGElementImpl::getValueProperty
var name = circle; // Should call toString()
var nodeName = circle.nodeName;
var prop = circle.cx; // Should call SVGCircleElementImpl::getValueProperty
alert('NODENAME: ' + nodeName + '\nID: ' + id + '\nNAME: ' + name + '\nPROP: ' + prop.baseVal.value);
}
function click(evt)
{
var circle = evt.target;
var id = circle.id; // Should call SVGElementImpl::getValueProperty
var name = circle; // Should call toString()
var nodeName = circle.nodeName;
var prop = circle.cx; // Should call SVGCircleElementImpl::getValueProperty
alert('NODENAME: ' + nodeName + '\nID: ' + id + '\nNAME: ' + name + '\nPROP: ' + prop.baseVal.value);
}
]]> </script>
<circle id="moo" onclick="click(evt)" cx="300" cy="225" r="100" fill="red"/>
</svg>