下面的html5的代码有错吗?按了按钮什么反应都没有。
<!DOCTYPEhtml><html><head><metacharset="utf-8"/><title></title><scripttype="text/java...
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript">
function n(){
var note =prompt("NewNote:");
var item document.createElement("li");
item.addEventListener("dblclick",function(){
delete_item(note);
},false);
var list=document.getElementById("list");
item.innerHTML =note;
list.appendChild(item);
}
function delete_item(item){
var list = document.getElementById("list");
for (var i=0;ii<list.childNodes.length,i++){
if(list.childNodes[i].innerHTML==length;i++){
list.removeChild(list.childNodes[i]);
}
}
}
</script>
</head>
<body>
<button onclick="n()">New Note</button>
<ul id="list"></ul>
</body>
</html> 展开
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript">
function n(){
var note =prompt("NewNote:");
var item document.createElement("li");
item.addEventListener("dblclick",function(){
delete_item(note);
},false);
var list=document.getElementById("list");
item.innerHTML =note;
list.appendChild(item);
}
function delete_item(item){
var list = document.getElementById("list");
for (var i=0;ii<list.childNodes.length,i++){
if(list.childNodes[i].innerHTML==length;i++){
list.removeChild(list.childNodes[i]);
}
}
}
</script>
</head>
<body>
<button onclick="n()">New Note</button>
<ul id="list"></ul>
</body>
</html> 展开
1个回答
展开全部
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript">
function n(){
var note=prompt("NewNote:");
var item=document.createElement("li");
item.addEventListener("dblclick",function(){
delete_item(note);
},false);
var list=document.getElementById("list");
item.innerHTML =note;
list.appendChild(item);
}
function delete_item(item){
var list = document.getElementById("list");
for (var i=0;ii<list.childNodes.length;i++){
if(list.childNodes[i].innerHTML==length){
list.removeChild(list.childNodes[i]);
}
}
}
</script>
</head>
<body>
<button onclick="n()">New Note</button>
<ul id="list"></ul>
</body>
</html>
帮你改好了 拿走不谢 给个采纳就好
问题是;写成了,还设有if语句里面多了个;i++ 其实都是不细心造成的。
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script type="text/javascript">
function n(){
var note=prompt("NewNote:");
var item=document.createElement("li");
item.addEventListener("dblclick",function(){
delete_item(note);
},false);
var list=document.getElementById("list");
item.innerHTML =note;
list.appendChild(item);
}
function delete_item(item){
var list = document.getElementById("list");
for (var i=0;ii<list.childNodes.length;i++){
if(list.childNodes[i].innerHTML==length){
list.removeChild(list.childNodes[i]);
}
}
}
</script>
</head>
<body>
<button onclick="n()">New Note</button>
<ul id="list"></ul>
</body>
</html>
帮你改好了 拿走不谢 给个采纳就好
问题是;写成了,还设有if语句里面多了个;i++ 其实都是不细心造成的。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询