java中 子窗体和父窗体_子窗体与父窗体传值操作的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 += '

           + '" class="deleteStyle">

deleteimge.png' + 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");

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值