未捕获的错误NOT_FOUND_ERR DOM Exception
uncaught error NOT_FOUND_ERR DOM Exception 8
所以我删除了特定div下的所有内容并添加了消息内容。但是,javascript在结束后抛出以下错误:
Uncaught Error: NOT_FOUND_ERR: DOM Exception 8
下面是执行它的代码
new Ajax.Request("profileThis.php",
{
method:'post',
parameters:{title:title, review:review, userId:userId, category:category, categoryId:categoryId},
onSuccess:function(ajax)
{
alert(ajax.responseText); // this is just for debugging purposes
var message=ajax.responseText;
var divMessage=document.createElement("div");
divMessage.style.color="rgb:(105,105,105)";
divMessage.innerHTML=message;
while($("reviewSheet").hasChildNodes)
{
$("reviewSheet").removeChild($("reviewSheet").lastChild);
}
$("reviewSheet").adopt(divMessage);
},
onFailure:ajaxFailure,
onException:ajaxFailure
});
人们评论说问题出在我如何将divMessage
分配给reviewSheet
。我尝试了adopt
和appendChild
,但没有一个工作。如果你能帮点忙,我将不胜感激。
divMessage.style.color="rgb:(105,105,105)";
应该divMessage.style.color="rgb(105,105,105)";
问题是你正在调用一个jQuery对象上的方法hasChildNodes() ?我不确定$("reviewSheet")应该是什么,但是在$()中包装字符串使其成为一个jQuery对象,我不相信它会与常规javascript方法一起工作。如果"reviewSheet"是一个元素的id你可以这样做
node = document.getElementById('reviewSheet');
那么你就可以进入while循环了
while (node.hasChildNodes()) {
//the rest of your code here
}
哦,你还需要在hasChildNodes()后面加上括号来返回一个布尔值
相关文章:
- 安装节点6后出错,npm ERR!无效版本:1.0.5beta
- system.err风格的控制台以javascript打印
- AngularJS:使用ng-show/hide动态维护下拉列表的3种状态(InProgress、Success、Err
- npm ERR!安装无法't在mac上读取依赖项
- Requirejs main.js could not be found
- JavaScript文件在IIS上返回404 Not Found
- 通过带有err,value签名的回调创建promise
- 在 Mocha 中,返回将被拒绝的承诺与调用 done(err) 的效果不同
- react-css-module module not found
- 节点服务器响应错误: process.nextTick(function(){throw err;});.
- aurelia-bundler gulp.js can't be found
- grails3 jquery not found
- GeckoFX JSContext not found C#
- res://ieframe.dll/acr-err 在 Java 6 上的 IE 11 //Windows 8/8.1/
- net::ERR CONTENT LENGTH MISMATCH in Chrome with Jboss WildFl
- Heroku,节点npm ERR!argv”/app/.heroku/note/bin/node”"/app/.
- Javascript:一个项目数组的sum-all-found.data()
- Aurelia npm install: tons of "gyp ERR"
- Marionette: childViewContainer was not found
- npm犯错!404 Not Found npm ERR!不,代码0