当前位置: 代码迷 >> ASP >> 怎么在服务器端判断信息提交页的复选框是否被选中
  详细解决方案

怎么在服务器端判断信息提交页的复选框是否被选中

热度:251   发布时间:2012-02-09 18:22:27.0
如何在服务器端判断信息提交页的复选框是否被选中?
信息提交页有4个复选框,名字不一样,对应4个不同字段,如果被选中,则对应该字段的值为1,如果未被选中,则为0,那么在服务器端进行信息入表时判断这4个复选框是否被选中该如何写呢?
这4个复选框名为ThreeCar,Bcar,ThreeInsure,People,我是这么写的:
        ThreeCar=Request.Form( "ThreeCar ")
Bcar=Request.Form( "Bcar ")
        ThreeInsure=Request.Form( "ThreeInsure ")
People=Request.Form( "People ")

if   ThreeCar=checked   then
ThreeCar=1
else
ThreeCar=0
end   if
if   Bcar=checked   then
Bcar=1
else
Bcar=0
end   if
if   ThreeInsure=checked   then
ThreeInsure=1
else
ThreeInsure=0
end   if
if   People=checked   then
People=1
else
People=0
end   if

------解决方案--------------------
ThreeCar=Request.Form( "ThreeCar ")
Bcar=Request.Form( "Bcar ")
ThreeInsure=Request.Form( "ThreeInsure ")
People=Request.Form( "People ")

if ThreeCar=checked then
ThreeCar= "A "
else
ThreeCar= " "
end if
if Bcar=checked then
Bcar= "B "
else
Bcar= " "
end if
if ThreeInsure=checked then
ThreeInsure= "C "
else
ThreeInsure= " "
end if
if People=checked then
People= "D "
else
People= " "
end if
Sel=ThreeCar+Bcar+ThreeInsure+People
将Sel传到服务器,用InStr处理!
  相关解决方案