代码:
<html>
<head>
<title></title>
</head>
<body >
<form name="form1" method="post" action="result.jsp">
<table border="1">
<tr>
<td>操作</td>
<td>用户名</td>
<td>密码</td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox" ></td>
<td><input type="text" name="userName"></td>
<td><input type="password" name="pwd"></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox" ></td>
<td><input type="text" name="userName"></td>
<td><input type="password" name="pwd"></td>
</tr>
</table>
</form>
<input type="button" value="提交" name="submit"">
</body>
</html>
问题:
当单击任意一个checkbox,再按“提交”按钮,这时表格中的一行数据就被提交到另外一个页面,怎么实现??
<html>
<head>
<title></title>
</head>
<body >
<form name="form1" method="post" action="result.jsp">
<table border="1">
<tr>
<td>操作</td>
<td>用户名</td>
<td>密码</td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox" ></td>
<td><input type="text" name="userName"></td>
<td><input type="password" name="pwd"></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox" ></td>
<td><input type="text" name="userName"></td>
<td><input type="password" name="pwd"></td>
</tr>
</table>
</form>
<input type="button" value="提交" name="submit"">
</body>
</html>
问题:
当单击任意一个checkbox,再按“提交”按钮,这时表格中的一行数据就被提交到另外一个页面,怎么实现??
这个问题我答过了
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript">
function check(){
var checkbox = document.getElementsByName("check");
// alert(checkbox[0].value);
var b ="";
for(var i = 0;i<checkbox.length;i++){
if(checkbox[i].checked){
b=b+checkbox[i].value
}
}
//删除一行你只要让每个checkbox的value=“数据库中需要删除的数据然后传到后台不就可以了”
//eg: <input type="checkbox" name="check" value="<input type='text' value='name'/>"/>
alert(b);
//return b;
//跳转window.location="<%=request.getContextPath() %>/regist.do?m="+b;
}
</script>
</head>
<body>
<input type="checkbox" name="check" value="第1个"/><br>
<input type="checkbox" name="check" value="第2个"/><br>
<input type="checkbox" name="check" value="第3个"/><br> <input type="button" onclick="check()" value="test"/>
</body>
</html>
你用checkbox传一个ID标识
数据库根据这个ID标识删除数据不就你显示的一行数据吗?