小弟刚学js,希望高手能够帮忙!
这是一个管理系统的中的项目参与人员选择的代码,要解决的问题是:1.用户点击选择人员后,弹出一个新窗口,能根据姓名或单位查找某个人,然后选择想要选择的人.然后继续查找下一个人.然后选择.
2 选择好要选的人员后,把值返回到主页面的人员的表单中
3 一个表单中可能有多处字段需要填入人员.
我把地址贴出来
http://www.hnkjc.com/ryxz.html,请高手指点!多谢!

解决方案 »

  1.   

    帮你修改了一下,因为涉及跨域操作,我在本机无法调试,你试试这些代码是否有用。<head>
    <script language="javascript">
    var return_input;function disp(obj) {
    return_input = obj;
    document.all.iframe1.style.display="block";
    }function shout() {
    document.all.iframe1.style.display="none";
    }function list_sub(){
    //获得IFRAME1中被选中员工的ID值
    var list_array;
    var n = 0;
    list_array = document.all.employee.contentWindow.document.getElementsByName('employee_id');
    var value_str="";
    for (var i=0; i<list_array.length; i++){
    if(list_array[i].checked){
    alert()
      value_str = value_str+","+list_array[i].id;
    n = n + 1;
    }//end if
    }//end for
    if(n == 1){
    value_str = value_str.substring(1,value_str.length);
    }
    return_input.value=value_str;
    document.all.iframe1.style.display="none";
    }

    function list_sub1(){
    //获得IFRAME1中被选中员工的ID值
    var list_array;
    var n = 0;
    list_array = document.all.employee.contentWindow.document.getElementsByName('employee_id');
    var value_str="";
    for (var i=0; i<list_array.length; i++){
    if(list_array[i].checked){
    alert()
      value_str = value_str+","+list_array[i].id;
    n = n + 1;
    }//end if
    }//end for
    if(n == 1){
    value_str = value_str.substring(1,value_str.length);
    } document.getElementById("pre").innerHTML=document.getElementById("pre").innerHTML+value_str;
    //document.write(list_value_str);
    //document.employee2.document.form1.text_value.value=list_value_str;
    }

    function list_sub2(){
    list_value_str = "";
    document.getElementById("pre").innerHTML="";
    //document.write(list_value_str);
    //document.employee2.document.form1.text_value.value=list_value_str;
    }
    </script><style type="text/css">
    <!--
    .STYLE2 { font-size: 14px;
    font-weight: bold;
    }
    .menu1 { BORDER-RIGHT: #000000 2px solid; BORDER-TOP: #adbac9 2px solid; BORDER-LEFT: #adbac9 2px solid; COLOR: #ffffff; BORDER-BOTTOM: #000000 2px solid; BACKGROUND-COLOR: #637994;position: absolute;
    }
    #iframe1 { position:absolute;
    left:197px;
    top:218px;
    width:459px;
    height:280px;
    z-index:1;
    }
    -->
    </style></head><body >
    <div class="menu1"  id="iframe1" style="display:none">
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="titlebar">
                <tr>
                  <td><span class="STYLE2">选择人员</span></td>
                </tr>
              </table>
                    <table width="98%" border="0" align="center" cellpadding="6" cellspacing="0">
                      <tr>
                        <td height="34"><div class="titlebar" id=pre name=pre></div>
                            <div align="right">
                              <input name="button3" type="button" class="header_btn" onClick="javascript:list_sub1();" value="继续提交">
                              <input name="button4" type="button" class="header_btn" onClick="javascript:list_sub();" value="选择完毕">
                              <input name="button5" type="button" class="header_btn" onClick="javascript:list_sub2();" value="清空">
                              <input name="button" type="button" class="header_btn" onClick="javascript:shout();"  value="关  闭">
                          </div></td>
                      </tr>
                    </table>
                <iframe src="http://www.hnkjc.com/project/y_1.asp" name="employee" height="200" width="100%"  border=1></iframe></td>
            </tr>
          </table></td>
        </tr>
      </table>
    </div><form action='pro_add_save.asp' method=post name=frmxx id="frmxx">
        <p>人员
          <input name="RY2" type="text" disabled class="input" id="select_person1">
          <input type="button" name="Submit" onClick="disp(select_person1);" value="选择">
        </p>
        <p>人员2  
          <input name="RY2" type="text" disabled class="input" id="select_person2">
          <input type="button" name="Submit2" onClick="disp(select_person2);" value="选择">
        </p>
    </form></body>
    </html>