首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > ASP >

一个简单的编程解决方案

2012-02-20 
一个简单的编程formaction methodpostinputtype checkbox name a1 value 11 inputtype

一个简单的编程
<form   action= " "   method=post>
    <input   type= "checkbox "   name= "a1 "   value= "11 ">
    <input   type= "checkbox "   name= "a2 "   value= "11 ">
    <input   type= "checkbox "   name= "a3 "   value= "11 ">
    <input   type= "checkbox "   name= "a4 "   value= "11 ">
                                                .
                                                .
                                                .
    <input   type= "checkbox "   name= "a15 "   value= "11 ">
</form>
  ==============================
请编一个程序循环获取这些值。


[解决办法]
使用同一个名字,获取的值会自动以逗号隔开。
[解决办法]
<form action= " " method=post>
<input type= "checkbox " name= "a1 " value= "11 ">
<input type= "checkbox " name= "a2 " value= "11 ">
<input type= "checkbox " name= "a3 " value= "11 ">
<input type= "checkbox " name= "a4 " value= "11 ">
<input type= "checkbox " name= "a15 " value= "11 ">
</form>
<script>
f = document.forms[0];
for(c=0; c <f.length; c++) alert(f.elements[c].value);
</script>

热点排行