请教如何 用JS获得gridview里指定单元格里label的值 你最好把生成的HTML发出来……ASP.NET不会…… 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这里是HTML 想获得 条形码里的信息 谢谢啊 <div id="Panel1" style="height:208px;width:498px;overflow-x:scroll;"> <div> <table cellspacing="0" rules="all" border="1" id="GridView1" style="width:480px;border-collapse:collapse;"> <tr> <th scope="col">用于选择</th><th scope="col">条形码</th><th scope="col">拼音</th><th scope="col">名称</th><th scope="col">金额</th><th scope="col">折扣价</th> </tr><tr id="GridView1_ctl02" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl02.checked=true;selectx(this)"> <td> <input id="ck" type="checkbox" /> </td><td> <span id="GridView1_ctl02_txm">12121</span> </td><td> YF </td><td> 衣服 </td><td> 600 </td><td> 0.9 </td> </tr><tr id="GridView1_ctl03" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl03.checked=true;selectx(this)"> <td> <input id="ck" type="checkbox" /> </td><td> <span id="GridView1_ctl03_txm">4454</span> </td><td> KZ </td><td> 裤子 </td><td> 700 </td><td> 0.8 </td> </tr><tr id="GridView1_ctl04" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl04.checked=true;selectx(this)"> <td> <input id="ck" type="checkbox" /> </td><td> <span id="GridView1_ctl04_txm">4545</span> </td><td> XZ </td><td> 鞋子 </td><td> 620 </td><td> 0.6 </td> <!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=gb2312" /><title>无标题文档</title></head><body><table cellspacing="0" rules="all" border="1" id="GridView1" style="width:480px;border-collapse:collapse;"> <tr> <th scope="col">用于选择 </th> <th scope="col">条形码 </th> <th scope="col">拼音 </th> <th scope="col">名称 </th> <th scope="col">金额 </th> <th scope="col">折扣价 </th> </tr> <tr id="GridView1_ctl02" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl02.checked=true;selectx(this)"> <td><input id="ck" type="checkbox" /> </td> <td><span id="GridView1_ctl02_txm">12121 </span> </td> <td> YF </td> <td> 衣服 </td> <td> 600 </td> <td> 0.9 </td> </tr> <tr id="GridView1_ctl03" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl03.checked=true;selectx(this)"> <td><input id="ck" type="checkbox" /> </td> <td><span id="GridView1_ctl03_txm">4454 </span> </td> <td> KZ </td> <td> 裤子 </td> <td> 700 </td> <td> 0.8 </td> </tr></table><button onclick="fun1()">第一行条形码</button><button onclick="fun2()">全部条形码</button><button onclick="fun3()">选中的条形码</button><script type="text/javascript">var tab = document.getElementById("GridView1");function fun1(){ alert(tab.rows[1].cells[1].innerHTML.replace(/<.*?>/g,"")); //alert(tab.rows[1].cells[1].innerText);//如果只是用在IE}function fun2(){ var str = ""; for(var i=1;i<tab.rows.length;i++) { str = str + tab.rows[i].cells[1].innerHTML.replace(/<.*?>/g,"") + " ";//同样,如果只用在IE下,可以用innerText代替 } alert(str);}function fun3(){ var str = ""; for(var i=1;i<tab.rows.length;i++) { if(tab.rows[i].cells[0].childNodes[0].checked) str = str + tab.rows[i].cells[1].innerHTML.replace(/<.*?>/g,"") + " ";//同样,如果只用在IE下,可以用innerText代替 } alert(str);}</script></body></html> jsp页面的鼠标移动问题 关于程序中设置了按键控制却没有反应的问题 模拟按钮enter为什么不成功,请大家帮助!!!!! 一段js选择性难题 ie6 不支持this关键字么? 如何让超链接的title不消失? 如何单独设置 div 边框的颜色对比度? ie5版本以下的浏览器不支持中文对象名 如何在text文本框禁止输入字母,而且控制输入数字的范围在1到35之间(用javascript) AngularJS <img> 绑定图片出问题? 在线等回答,等个高手帮帮忙 JS加载JSP的问题
<div id="Panel1" style="height:208px;width:498px;overflow-x:scroll;">
<div>
<table cellspacing="0" rules="all" border="1" id="GridView1" style="width:480px;border-collapse:collapse;">
<tr>
<th scope="col">用于选择</th><th scope="col">条形码</th><th scope="col">拼音</th><th scope="col">名称</th><th scope="col">金额</th><th scope="col">折扣价</th>
</tr><tr id="GridView1_ctl02" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl02.checked=true;selectx(this)">
<td>
<input id="ck" type="checkbox" />
</td><td>
<span id="GridView1_ctl02_txm">12121</span>
</td><td>
YF
</td><td>
衣服
</td><td>
600
</td><td>
0.9
</td>
</tr><tr id="GridView1_ctl03" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl03.checked=true;selectx(this)">
<td>
<input id="ck" type="checkbox" />
</td><td>
<span id="GridView1_ctl03_txm">4454</span>
</td><td>
KZ
</td><td>
裤子
</td><td>
700
</td><td>
0.8
</td>
</tr><tr id="GridView1_ctl04" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl04.checked=true;selectx(this)">
<td>
<input id="ck" type="checkbox" />
</td><td>
<span id="GridView1_ctl04_txm">4545</span>
</td><td>
XZ
</td><td>
鞋子
</td><td>
620
</td><td>
0.6
</td>
<!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=gb2312" />
<title>无标题文档</title>
</head>
<body>
<table cellspacing="0" rules="all" border="1" id="GridView1" style="width:480px;border-collapse:collapse;">
<tr>
<th scope="col">用于选择 </th>
<th scope="col">条形码 </th>
<th scope="col">拼音 </th>
<th scope="col">名称 </th>
<th scope="col">金额 </th>
<th scope="col">折扣价 </th>
</tr>
<tr id="GridView1_ctl02" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl02.checked=true;selectx(this)">
<td><input id="ck" type="checkbox" />
</td>
<td><span id="GridView1_ctl02_txm">12121 </span> </td>
<td> YF </td>
<td> 衣服 </td>
<td> 600 </td>
<td> 0.9 </td>
</tr>
<tr id="GridView1_ctl03" onmouseover="if(this!=prevselitem){this.style.backgroundColor='#Efefef'}" onmouseout="if(this!=prevselitem){this.style.backgroundColor='#ffffff'}" onclick="GridView1_ctl03.checked=true;selectx(this)">
<td><input id="ck" type="checkbox" />
</td>
<td><span id="GridView1_ctl03_txm">4454 </span> </td>
<td> KZ </td>
<td> 裤子 </td>
<td> 700 </td>
<td> 0.8 </td>
</tr>
</table>
<button onclick="fun1()">第一行条形码</button>
<button onclick="fun2()">全部条形码</button>
<button onclick="fun3()">选中的条形码</button>
<script type="text/javascript">
var tab = document.getElementById("GridView1");
function fun1()
{
alert(tab.rows[1].cells[1].innerHTML.replace(/<.*?>/g,""));
//alert(tab.rows[1].cells[1].innerText);//如果只是用在IE
}function fun2()
{
var str = "";
for(var i=1;i<tab.rows.length;i++)
{
str = str + tab.rows[i].cells[1].innerHTML.replace(/<.*?>/g,"") + " ";//同样,如果只用在IE下,可以用innerText代替
}
alert(str);
}function fun3()
{
var str = "";
for(var i=1;i<tab.rows.length;i++)
{
if(tab.rows[i].cells[0].childNodes[0].checked)
str = str + tab.rows[i].cells[1].innerHTML.replace(/<.*?>/g,"") + " ";//同样,如果只用在IE下,可以用innerText代替
}
alert(str);
}
</script>
</body>
</html>