求问qwq
xml怎么获取选中的节点文本,感觉我写的思路是对的,但不知道为什么不能获取文本,类比购物车选中衣服添加进去一样
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/style.css">
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script src="js/test.js"></script>
<title>使用HTML DOM操作表格</title>
<style type="text/css">
body{
font-size:13px;
line-height:25px;
}
table{
border-top: 1px solid #333;
border-left: 1px solid #333;
width:300px;
}
td{
border-right: 1px solid #333;
border-bottom: 1px solid #333;
}
.center{
text-align:center;
}
.title{
text-align:center;
font-weight:bold;
background-color: turquoise;
}
</style>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" id="myTable" name="em">
<tr >
<td class="center">姓名</td>
<td class="center">成绩</td>
</tr>
<tr >
<td>张三</td>
<td class="center">89</td>
</tr>
<tr >
<td>李四</td>
<td class="center">66</td>
</tr>
</table>
<div class="warp">
<p>姓名</p>
<table>
<tr>
<td>状态</td>
<td>选项</td>
</tr>
<tr>
<td><input name="Select" type="checkbox" value="Select"></td>
<td name="Selectl">钟离</td>
</tr>
<tr>
<td><input name="Select" type="checkbox" value="Select"></td>
<td name="Selectl">莫弈</td>
</tr>
<tr>
<td><input name="Select" type="checkbox" value="Select"></td>
<td name="Selectl">景元</td>
</tr>
<tr>
<td><input name="Select" type="checkbox" value="Select"></td>
<td name="Selectl">心海</td>
</tr>
<tr>
<td><input name="Select" type="checkbox" value="Select"></td>
<td name="Selectl">克拉拉</td>
</tr>
<tr>
<td><input name="Select" type="checkbox" value="Select"></td>
<td name="Selectl">卡芙卡</td>
</tr>
</table>
<div>
<a><span>全选 / 全不选</span></a>
<a><span>增加</span></a>
</div>
</div>
</body>
</html>
// JavaScript Document
$(function() {
//全选 or 全不选
$('div div a:eq(0)').toggle(
function(){$("input[name=Select]").attr("checked",'true');},
function(){$("input[name=Select]").removeAttr("checked");}
)
//删除选中邮件
$('div div a:eq(1)').click(function() {
$("input[name=Select]").each(function(){
if($(this).attr('checked')) {
var Name=document.getElementsByTagName("Selectl");
var aa=Name.nodeValue;
var msg = "<tr><td>"+aa+"</td></tr>";
}
$("table[name=em]").append(msg);
})
})
})