在规定时间内方有效的按钮(论坛中经常使用) dn001 2009-06-21 08:39:21 <!-- 把下列代码加到<body>区域中 --> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function selectivecheck(field, myselection) { var fieldid; var pos; var criteria; var strng; strng = myselection.value; for (i=0; i<field.length; i++) { if (strng=="all") { field[i ].checked = true; } else { fieldid = field[i ].id; pos = strng.substring(0,1); criteria = strng.substring(1,2); //this gets the information we want to evaluate if (fieldid.substring(pos,pos+1)==criteria) { field[ i].checked = true; } else { field[ i].checked = false; //you could leave this out if you don't want to clear the check boxes } } } } // End --> </script> <form> <table align="center"> <tr><td> <!--Load each ID with a string that will be parsed later --> <input id=a1 type=checkbox name=list value="1">Group A SubGroup 1<br> <input id=a2 type=checkbox name=list value="2">Group A SubGroup 2<br> <input id=b1 type=checkbox name=list value="3">Group B SubGroup 1<br> <input id=b2 type=checkbox name=list value="4">Group B SubGroup 2<br> <input id=c1 type=checkbox name=list value="5">Group C SubGroup 1<br> <input id=c2 type=checkbox name=list value="6">Group C SubGroup 2<br> <!--Set your option values that contain a position and then the criteria--> <p> 请你选择: <select size="1" name="mycombobox"> <option value="all">All Groups</option> <option value="0a ">Group A</option> <option value="0b ">Group B</option> <option value="0c ">Group C</option> <option value="11 ">SubGroup 1</option> <option value="12 ">SubGroup 2</option> </select> <br> <div align="center"> <input type="button" value="确定" onclick=" selectivecheck(this.form.list, this.form.mycombobox)"> </div> </td></tr> </table> </form>