繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> ASP基础 >> 绝对是好东西 (select1 <==> select2):

绝对是好东西 (select1 <==> select2):

2006-06-15 08:00:00  作者:  来源:互联网  浏览次数:0  文字大小:【】【】【
简介:关于如何动态地在同一页面实现两个互传 (s1 s2) (jaklin 2000.9.12) hello! 先祝大家中秋节快乐! 我们常常会碰到这样一个问题: 如何将在同一页面上的一个或的值传到另一个或中 ?这是一个很烦人的问题。可...
关键字:select 东西 绝对 gt lt

关于如何动态地在同一页面实现两个的值传到另一个

<%

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 "

"

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

责任编辑:admin
相关文章