如何用asp实现checkbox多选

来源:百度知道 编辑:UC知道 时间:2024/06/05 19:41:06
假设有N个checkbox,但我规定最多只能选3个,怎么解决

<%
if request("checkboxName")<>"" then
checkboxNo=UBound(Split(request("checkboxName"),","))
if checkboxNo>2 then
response.Write "<script LANGUAGE='javascript'>alert('最多只能选3个.');history.go(-1);</script>"
response.end
end if
end if
%>

随便写了一个,大概就是这个意思了

<!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>checkbox选择限制示例</title>
</head>