子窗体与父窗体传值示例js代码
发布时间:2020-12-14 23:25:39 所属栏目:资源 来源:网络整理
导读:复制代码 代码如下: //返回值给父窗体 function returnParent(value) {//获取子窗体返回值 var parent = window.dialogArguments; //获取父页面 //parent.location.reload(); //刷新父页面 if (parent != null parent != "undefined") { window.returnValue
复制代码 代码如下: //返回值给父窗体 function returnParent(value) {//获取子窗体返回值 var parent = window.dialogArguments; //获取父页面 //parent.location.reload(); //刷新父页面 if (parent != null && parent != "undefined") { window.returnValue = value; //返回值 window.close(); //关闭子页面 } //window.opener.document.getElementById("ActivityPic");//直接操作父窗体元素 //$(selector,window.parent.document);用于框架类页面 //$(selector,window.opener.document);这个适合单独打开的页面 return; } //打开模式子窗体,获取返回值进行操作 function showModalOnly(me,url) { //弹出窗体,单选 var hidden = document.getElementById(me); //获取隐藏的控件 if (hidden != null && hidden.value != null && hidden.value.length > 0) { alert("此处为单选,请先删除已有的选项,再次尝试选择。"); return; } var reValue = window.showModalDialog(url,window,"dialogHeight:500px; dialogWidth:987px; status:off; scroll:auto"); if (reValue == null || reValue == "undefined" || reValue == "") { return; //如果返回值为空,就返回 } var index = reValue.split("^"); //分割符 ^ 的位置 if (index[0] == null || index[0] == "undefined" || index[0].length < 1) { return; } var hid = index[0].split('&'); //为隐藏控件赋值 var view = index[1].split('&'); //显示值 var content = ""; //需要添加到check中的内容 if (hid != null && hid.length == 2) { var i = 0; if (hid[i] != "undefined" && hid[i] != "" && view[i + 1] != "undefined" && view[i + 1] != "") { content += '<table id="' + hid[i] + '" class="deleteStyle"><tr><td><img src="../../../Images/deleteimge.png" title="点击删除" alt="删除" onclick=" deleteTable(' + "'" + hid[i] + "'," + "'" + me + "'" + ');" /></td><td>' + view[i + 1] + '</td></tr></table>'; hidden.value = hid[i]; //为隐藏控件赋值 var c = document.getElementById("check" + me); c.innerHTML += content; return; } } alert("请只选择一条数据。"); return; } function openUploadWindow(url,width,height,left,top) { if(width==null) width=987; if (height == null) height = 500; if (left == null) left = 200; if (top == null) top = 200; //window.open(url,'newwindow','height=' + height + ',width=' + width + ',top=200,left=200,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no'); window.showModalDialog(url,"dialogHeight:" + height + "px; dialogWidth:" + width + "px;status:off; scroll:auto;dialogLeft:"+left+"px;dialogTop:"+top+"px"); } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |