<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
function confirmform1(){
if (!returnhasonechecked()) {
alert("请选择一个!");
return false;
}
return true;
}
function returnhasonechecked(){
var num=2;
var bb=false;
for(i=1;i<=num;i++){
if(document.all("checkbox"+i).checked==false){
}else bb=true;
}
return bb;
}
</script>
</head>
<body>
<form name="form1" method="post" action="index.jsp" onSubmit="return confirmform1()">
<input type="checkbox" name="checkbox1" value="checkbox" id="checkbox1">
11
<input type="checkbox" name="checkbox2" value="checkbox" id="checkbox2">
22
<input type="submit" name="Submit" value="提交" id="Submit">
</form>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="javascript">
function confirmform1(){
if (!returnhasonechecked()) {
alert("请选择一个!");
return false;
}
return true;
}
function returnhasonechecked(){
var num=2;
var bb=false;
for(i=1;i<=num;i++){
if(document.all("checkbox"+i).checked==false){
}else bb=true;
}
return bb;
}
</script>
</head>
<body>
<form name="form1" method="post" action="index.jsp" onSubmit="return confirmform1()">
<input type="checkbox" name="checkbox1" value="checkbox" id="checkbox1">
11
<input type="checkbox" name="checkbox2" value="checkbox" id="checkbox2">
22
<input type="submit" name="Submit" value="提交" id="Submit">
</form>
</body>
</html>