实现如下效果:
在form表单中,
有一个单选框和一个多选框
大致如下:
单选框1 单选框2 单选框3
业务平台 待选业务 已选平台
12 >>>
13 >>
14 <<
15 <<<
点击单选框2,下面的待选业务平台显示业务12,13 ,点击单选框2待选业务平台显示业务14,15,
点击单选框1,下面的待选业务平台显示单选框2和单选框3的所以业务
点击3个向右的箭头能将左侧所有的业务都加入到右侧的已选平台中,点击2个向右的箭头,能任意选择多个业务,
点击向左的2个箭头能将已选平台的任意几个业务取消,点击向左的3个箭头能将已选平台的所有业务都取消
在form表单中,
有一个单选框和一个多选框
大致如下:
单选框1 单选框2 单选框3
业务平台 待选业务 已选平台
12 >>>
13 >>
14 <<
15 <<<
点击单选框2,下面的待选业务平台显示业务12,13 ,点击单选框2待选业务平台显示业务14,15,
点击单选框1,下面的待选业务平台显示单选框2和单选框3的所以业务
点击3个向右的箭头能将左侧所有的业务都加入到右侧的已选平台中,点击2个向右的箭头,能任意选择多个业务,
点击向左的2个箭头能将已选平台的任意几个业务取消,点击向左的3个箭头能将已选平台的所有业务都取消
解决方案 »
- struts2中页面的列表中,前面想有一组自动编号的数字,应该怎么实现呢?
- 奇怪的classNotfontException:com.microsoft.sqlserver.jdbc.SQLServerDriver
- 求cookie自动登录代码
- 刚出锅的大难题,不回答,也来看看咯~~~~~
- jsp问题:如何防止界面挥发
- 用sql语句查询当前seq值出现的问题,救命啊!急,急,急,在线等!!!!
- Tiles和template有什么区别?
- 用request.getParameter()传值
- 怎么在window.location.href加入target信息?
- java的高级问题
- JSP 模糊查询问题
- Request[/channel] does not contain handler parameter named 'op'. This may be ca
<table>
<tr>
我想去的地方:
<input type = radio name = "name1">欧洲
<input type = radio name = "name1">美洲
<input type = radio name = "name1">亚洲
</tr>
<tr>
国家
<select>
<option value ="英国">英国
<option value ="法国">法国
<option value ="西班牙">西班牙
<option value ="美国">美国
<option value ="加拿大">加拿大
<option value ="中国">中国
<option value ="泰国">泰国
<option value ="日本">日本
</select>
</tr>
</table>
</form>
现在有这样一个单选和多选框,我的需求是选择上面的欧洲时,下面的国家的多选框中只显示英国,法国,西班牙;选择美洲是显示美国和加拿大;选择亚洲时显示中国,泰国和日本,使用js完成这个效果
jquery很好实现的
几个radio加上onclick事件
每个radion对应一个事件,给select起个id或name
通过id添加对应的option
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript" type="text/javascript">
var selector;
var option;
var text;
function createOption(value, text){
option = document.createElement("option");
option.setAttribute("value", value);
selector.appendChild(option);
text = document.createTextNode(text);
option.appendChild(text);
} function selectItems(radio){
var type = radio.value;
selector = document.getElementById("select");
if("u"==type){
var k = selector.options.length;
for(var i=k; i>=0; i--){
selector.options.remove(i);
}
createOption("EN","英国");
createOption("FN","法国");
createOption("Spain","西班牙");
}
else if("am"==type){
var k = selector.options.length;
for(var i=k; i>=0; i--){
selector.options.remove(i);
}
createOption("AM","美国");
createOption("CAN","加拿大");
}
else if("as"==type){
var k = selector.options.length;
for(var i=k; i>=0; i--){
selector.options.remove(i);
}
createOption("CHN","中国");
createOption("Thailand","泰国");
createOption("Japan","日本");
}
}
</script>
</head><body>
<form action="" method="post">
<table>
<tr>
<td>我想去的地方:
<input type="radio" name="radio" value="u" onclick="selectItems(this);" />
欧洲
<input type="radio" name="radio" value="am" onclick="selectItems(this);" />
美洲
<input type="radio" name="radio" value="as" onclick="selectItems(this);" />
亚洲
</td></tr>
<tr> <td>国家
<select size="1" id="select">
<!--option value ="英国" id="c1">英国
<option value ="法国" id="c2">法国
<option value ="西班牙" id="c3">西班牙
<option value ="美国" id="c4">美国
<option value ="加拿大" id="c5">加拿大
<option value ="中国" id="c6">中国
<option value ="泰国" id="c7">泰国
<option value ="日本" id="c8">日本-->
</select>
</td></tr>
</table>
</form>
</body>
</html>仅供参考^_^
参考下这个