表格如下,当点“修改”的时候,我希望能带入 checkbox 的数值,
请教,,谢谢。<table>
<tr>
<td> <input type="checkbox" name="ttt" value="1"></td>
<td> <a href="test.asp?ttt=ttt ">修改</a> </td>
</tr>
</table>
请教,,谢谢。<table>
<tr>
<td> <input type="checkbox" name="ttt" value="1"></td>
<td> <a href="test.asp?ttt=ttt ">修改</a> </td>
</tr>
</table>
我一般动态生成<a></a>的时候就把checkbox的value写进去了。
或者给超链接指定一个方法,把checkbox的值作为这个方法的参数。
while($data = mysql_fetch_array($result))
{
echo "<li><span class='date'>" .$data[2]. "</span><a href='javascript:funcShowInfo(".$data[0].");'>".$data[1]."</a></li>\r\n";
}
<table>
<tr>
<td> <input type="checkbox" name="ttt" value="1">1 <input type="checkbox" name="ttt" value="2">2</td>
<td> <a href="javascript:fun()">修改</a> </td>
</tr>
</table>
<SCRIPT LANGUAGE="JavaScript">
<!--
function fun() {
var str = "";
for (var i=0; i<ttt.length; i++)
{
if(ttt[i].checked) str += ttt[i].value +",";
}
if (str.length > 0) str = str.substring(0,str.length-1);//去掉最后一个","
window.location = "test.asp?ttt='"+ str +"'";
}
//-->
</SCRIPT>
好像,checkbox的值并没有跟着“选上” 或者“不选” 而变化,值一直是0的确有多个checkbox ,如下<table>
<tr>
<td> <input type="checkbox" name="ttt" value="1"></td>
<td> <input type="checkbox" name="ttt" value="0"></td>
<td> <a href="test.asp?lid=<%=lid%>&ttt="onclick="this.href+=document.getElementsByName('ttt')[0].value">修改</a> </td>
</tr>
</table>