当前位置: 代码迷 >> ASP.NET >> JS弹出窗口返回值有关问题
  详细解决方案

JS弹出窗口返回值有关问题

热度:4068   发布时间:2013-02-25 00:00:00.0
JS弹出窗口返回值问题!
页面如下
C# code
父画面是这么写的<script language="javascript" type="text/javascript">   function openReasonWin()     {     //新窗口的文档名称   var srcFile = "SelUserName.aspx";         //高度,位置等   var winFeatures = "dialogHeight:550px; dialogLeft:300px;";         //把输入页面的reason input传给弹出窗口   var obj = document.getElementById("Button2");        //将input作为对象传递给新窗口   //ok,open new windows         /*   设置传给子窗口的值   obj.value="要传递的值";   */         window.showModalDialog(srcFile, obj, winFeatures);     }   </script><form id="Form" name="Form" action="" runat="server"><input id="txt_Cyr" name="txt_Cyr" type="text" /><input id="Button2" type="button" class="button" onclick="openReasonWin()" value="弹出" />子页面是这么写的function aa() {   var objs = document.getElementsByTagName("input"); //拼凑的字符串   var str = ''; //遍历   for (var i = 0; i < objs.length; i++) {//遍历所有的,被选中的复选框   if (objs[i].type.toLowerCase() == "checkbox" && objs[i].checked)   //连接客串   strstr = str + objs[i].value + ',';   }   window.opener.document.Form.txt_Cyr.value = str;   window.close();}<input id="Button1" type="button" onclick="aa()" value="提交" />当我点击提交的时候 弹出无法获取属性document的值,对象为空的网页错误

求解.. 怎么能让我选择的值传回到 父页面中的文本框中

------解决方案--------------------------------------------------------
JScript code
    var label = document.getElementById(objs[i].id).nextSibling;     if(label!=null)         str = str + label.innerHTML + ',';
  相关解决方案