我正在使用http://alexgorbatchev.com/SyntaxHighlighter/突出显示我网站上的代码,但有时在我的日志中我会收到如下Javascript错误:
Uncaught NotFoundError:无法在'Node'上执行'removeChild':要删除的节点不再是此节点的子节点.也许它被移动到'模糊'事件处理程序中?
Uncaught NotFoundError:尝试在不存在的上下文中引用节点.
// set up handler for lost focus
attachEvent(textarea, 'blur', function(e)
{
textarea.parentNode.removeChild(textarea);
removeClass(highlighterDiv, 'source');
});
Run Code Online (Sandbox Code Playgroud)
这是attachEvent()函数代码:
function attachEvent(obj, type, func, scope)
{
function handler(e)
{
e = e || window.event;
if (!e.target)
{
e.target = e.srcElement;
e.preventDefault = function()
{
this.returnValue = false;
};
}
func.call(scope || window, e);
};
if (obj.attachEvent)
{
obj.attachEvent('on' + type, handler);
}
else
{
obj.addEventListener(type, handler, false);
}
};
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙解决这个问题吗?
javascript ×1