栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > Web开发 > JavaScript

子窗体与父窗体传值示例js代码

JavaScript 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

子窗体与父窗体传值示例js代码

复制代码 代码如下:
//返回值给父窗体
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 += '
+ "'" + hid[i] + "'," + "'" + me + "'" + ');" />' + view[i + 1] + '
';
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, window, "dialogHeight:" + height + "px; dialogWidth:" + width + "px;status:off; scroll:auto;dialogLeft:"+left+"px;dialogTop:"+top+"px");
}
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/110708.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号