PC6下载站

分类分类

关于如何动态地在同一页面实现两个<select>互传 

关注+2004-11-07作者:蓝点

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





   

     

     

    <%  

     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






展开全部

相关文章

更多+相同厂商

热门推荐

  • 最新排行
  • 最热排行
  • 评分最高
排行榜

    点击查看更多

      点击查看更多

        点击查看更多

        说两句网友评论

          我要评论...
          取消