资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
javascript select控件间内容互相移动
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20language%3D%22javascript%22%3E%20%0D%0Afunction%20add()%7B%20%0D%0Avar%20opt%3Dselectfrom.options%3B%20%0D%0Alen%3Dopt.length%3B%20%0D%0Afor(i%3Dlen-1%3Bi%3E-1%3Bi--)%7B%20%0D%0Aif(opt%5Bi%5D.selected)%7B%20%0D%0Aselect2.appendChild(opt%5Bi%5D)%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20addAll()%7B%20%0D%0Avar%20opt%3Dselectfrom.options%3B%20%0D%0Alen%3Dopt.length%3B%20%0D%0Afor(i%3Dlen-1%3Bi%3E-1%3Bi--)%7B%20%0D%0Aselect2.appendChild(opt%5Bi%5D)%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20del()%7B%20%0D%0Avar%20opt%3Dselect2.options%3B%20%0D%0Alen%3Dopt.length%3B%20%0D%0Afor(i%3Dlen-1%3Bi%3E-1%3Bi--)%7B%20%0D%0Aif(opt%5Bi%5D.selected)%7B%20%0D%0Aselectfrom.appendChild(opt%5Bi%5D)%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%0D%0Afunction%20delAll()%7B%20%0D%0Avar%20opt%3Dselect2.options%3B%20%0D%0Alen%3Dopt.length%3B%20%0D%0Afor(i%3Dlen-1%3Bi%3E-1%3Bi--)%7B%20%0D%0Aselectfrom.appendChild(opt%5Bi%5D)%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%3C%2Fscript%3E"> <body> <table width="27%" height="194" border="0" cellpadding="1" cellspacing="0"> <tr> <td width="21%"><select id="selectfrom" size="15" multiple="multiple" style="width:100px"> <option>a</option> <option>b</option> <option>c</option> <option>d</option> <option>e</option> <option>f</option> <option>g</option> <option>h</option> <option>i</option> <option>j</option> <option>k</option> <option>j</option> <option>m</option> <option>n</option> </select></td> <td width="57%"><p align="center"> <input name="addAll" type="button" id="addAll" value=" >> " style="width:40px" onclick="addAll()"/> </p> <p align="center"> <input name="add" type="button" id="add" style="width:40px" value=" > " onclick="add()"/> </p> <p align="center"> <input name="del" type="button" id="del" value=" < " style="width:40px" onclick="del()"/> </p> <p align="center"> <input name="delAll" type="button" id="delAll" value=" << " style="width:40px" onclick="delAll()"/> </p></td> <td width="22%"><select id="select2" size="15" multiple="multiple" style="width:100px"> </select></td> </tr> </table> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程