I'm trying to write SVG scripted code where you can click on a circle
and drag it. Actually, I'm using code from
http://croczilla.com/svg/samples/events2. As expected, the code works
perfectly in Firefox, but in Internet Explorer I get an error message
when I click on the circle: "'circle.cx.baseVal' is null or not an
object". I've seen references to baseVal not working in Adobe SVG
Viewer. My question is, what's the easiest ASV-friendly alternative?
I've heard something about using "circle.getAttribute" and
"circle.setAttribute", but it doesn't seem to help, unless I just
don't know how to use it properly.
This script is being used in a .SVG file.
Here's the script, for context:
<script type="text/ecmascript">
<![CDATA[
var dx,dy;
var circle;
function init()
{
circle = document.getElementById('circ');
circle.addEventListener("mousedown", mousedown_listener, false);
}
function mousedown_listener(evt)
{
dx = circle.cx.baseVal.value - evt.clientX;
dy = circle.cy.baseVal.value - evt.clientY;
document.addEventListener("mousemove", mousemove_listener, true);
document.addEventListener("mouseup", mouseup_listener, true);
}
function mouseup_listener(evt)
{
document.removeEventListener("mousemove", mousemove_listener, true);
document.removeEventListener("mouseup", mouseup_listener, true);
}
function mousemove_listener(evt)
{
var id = circle.ownerSVGElement.suspendRedraw(1000);
circle.cx.baseVal.value = evt.clientX + dx;
circle.cy.baseVal.value = evt.clientY + dy;
circle.ownerSVGElement.unsuspendRedraw(id);
}
]]>
</script>
-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my
membership"
----
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/