PC6下载站
PC6下载站
●
分类
分类
首页
软件
网游
专题
资讯
厂商
礼包
手游库
软件库
排行榜
关于如何动态地在同一页面实现两个<select>互传
关注+
2004-11-07
作者:蓝点
关于如何动态地在同一页面实现两个
互传 (s1 <==> s2)
(jaklin )
hello! 先祝大家
中秋
节快乐!
我们常常会碰到这样一个问题: 如何将在同一页面上的一个
或
的值传到另一个
或
中 ?这是一个很烦人的问题。可是有时候你偏偏会遇到。 那什么办呢?
下面是我“烟酒”了一个上午, 现贴上来让大家
共享
。 用的方法是很笨也挺麻烦。不过总是有点成就感的。呵呵!大家看看, 指点指点.....
<%@ Language=VBScript %>
11111
22222
33333
->>
<<-
<%
str="function do_select() {" & vbCrlf & _
"if (document.form1.select1.options.length > 0) {"&vbCrlf&_
"var j=0;"&vbCrlf&_
"for(var i=0;i
"if(document.form1.select1.options(i).selected) {"&vbCrlf& _
"j=j+1; break" & vbCrlf & "}"&vbCrlf & "}"&vbCrlf& _
"if (j > 0) {"&vbCrlf&_ "document.form1.sel2.options[document.form1.sel2.options.length] = new Option(" & _
"document.form1.select1.options[document.form1.select1.selectedIndex].value," & _
"document.form1.select1.options[document.form1.select1.selectedIndex].value);"& vbCrlf
Response.Write "
"
Response.Write "
"
str=str&vbCrlf&"document.form1.select1.options[document.form1.select1.selectedIndex]=null;"&vbCrlf & _
"if (document.form1.select1.options.length > 1) {"&vbCrlf '&_
str=str&vbCrlf & "}" & vbCrlf & "}" & vbCrlf& "}" & vbCrlf& "}" & vbCrlf
Response.Write "
" & vbCrlf
Response.Write str & vbCrlf & "
"& vbCrlf
%>
<%
str=""
str="function do_select2() {" & vbCrlf & _
"if (document.form1.sel2.options.length > 0) {"&vbCrlf&_
"var j=0;"&vbCrlf&_
"for(var i=0;i
"if(document.form1.sel2.options(i).selected) {"&vbCrlf& _
"j=j+1; break" & vbCrlf & "}"&vbCrlf & "}"&vbCrlf& _
"if (j > 0) {"&vbCrlf&_
"document.form1.select1.options[document.form1.select1.options.length] = new Option(" & _
"document.form1.sel2.options[document.form1.sel2.selectedIndex].value," & _
"document.form1.sel2.options[document.form1.sel2.selectedIndex].value);"& vbCrlf
str=str&"document.form1.sel2.options[document.form1.sel2.selectedIndex] =null;" & vbCrlf &"}"& vbCrlf &"}"& vbCrlf &"}"
Response.Write "
" & vbCrlf
Response.Write str & vbCrlf & "
"& vbCrlf
%>
很笨吧, 哈哈!
若那位大虾有更好的方法, 可别忘了给我寄上一份哦。
E_Mail: fz_chenjl@163.net
分享:
展开全部
相关文章
Mac访问Windows共享文件夹
Windows 7正版系统验证方法
windows 8.1系统版本号查看方法
Windows 8.1系统电话激活时无法输入微软返回代码解
Windows 8如何调整屏幕分辨率
windows8.1磁盘占用100%解决方法
更多+
相同厂商
热门
推荐
最新排行
最热排行
评分最高
排行榜
点击查看更多
点击查看更多
点击查看更多
说两句
网友评论
我要评论...
取消