热门关键字:  PHP  Cisco  seo  网络广告 虚拟主机 中文域名
当前位置 :| 主页>网页特效>表单操作>

对input框的分组选择功能的实现,可真是非常实用的效果

来源: 作者: 时间:2005-12-31 点击:


<!-- 要实现此效果需要 1 个步骤: -->

<!-- 第 1 步: -->
<!-- 把下面的代码加到<BODY></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>


最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
赞助商连接