I've been playing with animation in an SVG: http://imgh.us/renamon-animtest.svg (links to script "anim.js")
In the window.onload event, I have:
function init(evt)
{
if(window.svgDocument == null)
{
if(evt.target && evt.target.ownerDocument)
svgDocument = evt.target.ownerDocument;
else if(evt.originalTarget && evt.originalTarget.ownerDocument)
svgDocument = evt.originalTarget.ownerDocument;
else svgDocument = document;
}
_debug = svgDocument.getElementById('debug');
alert(_debug.firstChild.nodeValue);
for(i = 0; i < 1; i++)
balls[i] = svgDocument.getElementById('ball' + i);
setInterval(loop, 50);
}
It can find the 'ball' objects fine, but not the 'debug' object (getElementById returns null). I can see it in the source, so why can't the script find it?