Topic: 关于复选框传值问题

  Print this page

1.关于复选框传值问题 Copy to clipboard
Posted by: zhangyingwu
Posted on: 2005-12-30 19:34

大家谁能帮我看一下,我怎么就不能把复选框里面的值送出去啊。
<script language="javascript">

function send()
{
document.location.href="a.html?data="+document.form1.che.value;
}
</script>

<form name="form1" action="a.html" method="get">

<label> A相
<input type="checkbox" name="che" value="0001">
</label>
<label> B相
<input type="checkbox" name="che" value="0002">
</label>
<label> C相
<input type="checkbox" name="che" value="0003">
</label>
<a href="javascript:send()" >aaa</a>
</form>

2.Re:关于复选框传值问题 [Re: zhangyingwu] Copy to clipboard
Posted by: 毒毒√快山
Posted on: 2006-01-24 10:49

你既然有form 干吗不就用form 来传值能,还要用个超连接呢?

3.Re:关于复选框传值问题 [Re: zhangyingwu] Copy to clipboard
Posted by: 毒毒√快山
Posted on: 2006-01-24 10:53

bbb.jsp
<form name="form1" action="aaa.html" method="get">
<label> A相
<input type="checkbox" name="che" value="0001">
</label>
<label> B相
<input type="checkbox" name="che" value="0002">
</label>
<label> C相
<input type="checkbox" name="che" value="0003">
</label>
</form>
-------------------------------------------
aaa.jsp
String[] array = request.getParameterValues("che");
if(array != null && array.length != 0){
for(int i=0; i<array.length; i++){
  System.out.println(array[i]);
}
}

4.Re:关于复选框传值问题 [Re: zhangyingwu] Copy to clipboard
Posted by: ma1673
Posted on: 2006-02-06 17:31

对咯,复选框就是个字符数组


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923