<asp:TemplateField HeaderText="选中" InsertVisible="False">
<ItemTemplate>
<input type="radio" name="r" onclick="test()" value="<%# Container.DataItemIndex %>" />
</ItemTemplate>
</asp:TemplateField> function test()
{
var div = document.getElementById("top");
document.cookie = "postion="+div.scrollTop+";path=/;";
var a = document.getElementsByName("r");
for(i=0;i<a.length;i++)
{
if(a[i].checked)
{
alert(a[i].value);
}
}
// document.cookie = "rowindex="+eobj.value+";path=/;";
//alert(document.cookie);
}
说什么也得不着value!!!!!!!!!!!!!!!!!!!!!请帮帮忙
<ItemTemplate>
<input type="radio" name="r" onclick="test()" value="<%# Container.DataItemIndex %>" />
</ItemTemplate>
</asp:TemplateField> function test()
{
var div = document.getElementById("top");
document.cookie = "postion="+div.scrollTop+";path=/;";
var a = document.getElementsByName("r");
for(i=0;i<a.length;i++)
{
if(a[i].checked)
{
alert(a[i].value);
}
}
// document.cookie = "rowindex="+eobj.value+";path=/;";
//alert(document.cookie);
}
说什么也得不着value!!!!!!!!!!!!!!!!!!!!!请帮帮忙
<table cellspacing="0" align="Left" border="0" id="dg_keys" style="font-size:12px;width:98%;border-collapse:collapse;">
<tr class="fixTitle" align="left" style="background-color:GhostWhite;font-weight:bold;white-space:nowrap;">
<th scope="col">行号</th><th scope="col">选中</th><th scope="col">关键词</th><th scope="col">文章</th><th scope="col">贴吧</th><th scope="col">下载</th><th scope="col">圈子</th><th scope="col">视频</th><th scope="col">文件夹名</th><th scope="col">id</th><th scope="col">upid</th>
</tr><tr>
<td>1</td><td>
<input type="radio" name="r" onClick="alert(this.value);" value="0" />
</td><td>连锁销售</td><td>
<input name="dg_keys$ctl02$c_article" type="text" value="连锁销售" id="dg_keys_ctl02_c_article" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl02$c_post" type="text" value="连锁销售" id="dg_keys_ctl02_c_post" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl02$c_download" type="text" value="连锁销售" id="dg_keys_ctl02_c_download" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl02$c_quanzi" type="text" value="连锁销售" id="dg_keys_ctl02_c_quanzi" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl02$c_video" type="text" value="连锁销售" id="dg_keys_ctl02_c_video" style="width:100px;" />
</td><td>
<a id="dg_keys_ctl02_c_englishname" href="http://www.yewuyuan.com/zhuanti/liansuoxiaoshou" target="_blank">liansuoxiaoshou</a>
</td><td>184</td><td>183</td>
</tr><tr style="background-color:GhostWhite;">
<td>2</td><td>
<input type="radio" name="r" onclick='alert(this.value);' value="1" />
</td><td>销售合同</td><td>
<input name="dg_keys$ctl03$c_article" type="text" value="销售合同" id="dg_keys_ctl03_c_article" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl03$c_post" type="text" value="销售合同" id="dg_keys_ctl03_c_post" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl03$c_download" type="text" value="销售合同" id="dg_keys_ctl03_c_download" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl03$c_quanzi" type="text" value="销售合同" id="dg_keys_ctl03_c_quanzi" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl03$c_video" type="text" value="销售合同" id="dg_keys_ctl03_c_video" style="width:100px;" />
</td><td>
<a id="dg_keys_ctl03_c_englishname" href="http://www.yewuyuan.com/zhuanti/xiaoshouhetong" target="_blank">xiaoshouhetong</a>
</td><td>189</td><td>183</td>
</tr><tr>
<td>3</td><td>
<input type="radio" name="r" onclick='alert(this.value);' value="2" />
</td><td>网络销售</td><td>
<input name="dg_keys$ctl04$c_article" type="text" value="网络销售" id="dg_keys_ctl04_c_article" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl04$c_post" type="text" value="网络销售" id="dg_keys_ctl04_c_post" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl04$c_download" type="text" value="网络销售" id="dg_keys_ctl04_c_download" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl04$c_quanzi" type="text" value="网络销售" id="dg_keys_ctl04_c_quanzi" style="width:100px;" />
</td><td>
<input name="dg_keys$ctl04$c_video" type="text" value="网络销售" id="dg_keys_ctl04_c_video" style="width:100px;" />
</td><td>
<a id="dg_keys_ctl04_c_englishname" href="http://www.yewuyuan.com/zhuanti/wangluoxiaoshou" target="_blank">wangluoxiaoshou</a>
</td><td>190</td><td>183</td>
<table cellspacing="0" align="Left" border="0" id="dg_keys" style="font-size:12px;width:98%;border-collapse:collapse;">
<tr class="fixTitle" align="left" style="background-color:GhostWhite;font-weight:bold;white-space:nowrap;">
<th scope="col">行号 </th> <th scope="col">选中 </th> <th scope="col">关键词 </th> <th scope="col">文章 </th> <th scope="col">贴吧 </th> <th scope="col">下载 </th> <th scope="col">圈子 </th> <th scope="col">视频 </th> <th scope="col">文件夹名 </th> <th scope="col">id </th> <th scope="col">upid </th>
</tr> <tr>
<td>1 </td> <td>
<input type="radio" name="r" onClick="test()" value="0" />
</td> <td>连锁销售 </td> <td>
<input name="dg_keys$ctl02$c_article" type="text" value="连锁销售" id="dg_keys_ctl02_c_article" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl02$c_post" type="text" value="连锁销售" id="dg_keys_ctl02_c_post" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl02$c_download" type="text" value="连锁销售" id="dg_keys_ctl02_c_download" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl02$c_quanzi" type="text" value="连锁销售" id="dg_keys_ctl02_c_quanzi" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl02$c_video" type="text" value="连锁销售" id="dg_keys_ctl02_c_video" style="width:100px;" />
</td> <td>
<a id="dg_keys_ctl02_c_englishname" href="http://www.yewuyuan.com/zhuanti/liansuoxiaoshou" target="_blank">liansuoxiaoshou </a>
</td> <td>184 </td> <td>183 </td>
</tr> <tr style="background-color:GhostWhite;">
<td>2 </td> <td>
<input type="radio" name="r" onclick='test()' value="1" />
</td> <td>销售合同 </td> <td>
<input name="dg_keys$ctl03$c_article" type="text" value="销售合同" id="dg_keys_ctl03_c_article" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl03$c_post" type="text" value="销售合同" id="dg_keys_ctl03_c_post" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl03$c_download" type="text" value="销售合同" id="dg_keys_ctl03_c_download" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl03$c_quanzi" type="text" value="销售合同" id="dg_keys_ctl03_c_quanzi" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl03$c_video" type="text" value="销售合同" id="dg_keys_ctl03_c_video" style="width:100px;" />
</td> <td>
<a id="dg_keys_ctl03_c_englishname" href="http://www.yewuyuan.com/zhuanti/xiaoshouhetong" target="_blank">xiaoshouhetong </a>
</td> <td>189 </td> <td>183 </td>
</tr> <tr>
<td>3 </td> <td>
<input type="radio" name="r" onclick='test()' value="2" />
</td> <td>网络销售 </td> <td>
<input name="dg_keys$ctl04$c_article" type="text" value="网络销售" id="dg_keys_ctl04_c_article" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl04$c_post" type="text" value="网络销售" id="dg_keys_ctl04_c_post" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl04$c_download" type="text" value="网络销售" id="dg_keys_ctl04_c_download" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl04$c_quanzi" type="text" value="网络销售" id="dg_keys_ctl04_c_quanzi" style="width:100px;" />
</td> <td>
<input name="dg_keys$ctl04$c_video" type="text" value="网络销售" id="dg_keys_ctl04_c_video" style="width:100px;" />
</td> <td>
<a id="dg_keys_ctl04_c_englishname" href="http://www.yewuyuan.com/zhuanti/wangluoxiaoshou" target="_blank">wangluoxiaoshou </a>
</td> <td>190 </td> <td>183 </td>
<script>
function test()
{
var a = document.getElementsByName("r");
for(i=0;i <a.length;i++)
{
if(a[i].checked)
{
alert(a[i].value);
}
}
// document.cookie = "rowindex="+eobj.value+";path=/;";
//alert(document.cookie);
}
</script>=======
没有问题的。
你ID怎么会变成这个id="dg_keys_ctl05_Label2" 你的ID应该是r
JS取值用getElementById
你要用name JS应该是
var a = document.getElementsByName("r");
for(i=0;i <a.length;i++)
{
if(a[i].checked)
{
alert(a[i].attributes.getNamedItem('value').nodeValue);
}
} request.form["r"]得不到应该是你没提交
JS得的到
request.form["r"]得不到应该是你没提交
var valueId;
var radList = bookList.getElementsByTagName("input");
for(var i=0;i<radList.length;i++)
{
if(radList[i].checked == true)
{
valueId = radList[i].value;
}
}