3
我一直在玩动画的SVG找到流动的文本元素:无法通过ID在SVG
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);
}
它可以找到 '球' 罚款的对象,而不是 '调试' 对象(的getElementById返回null)。我可以在源代码中看到它,为什么脚本无法找到它?