您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

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

2025/11/12 8:44:43发布32次查看
复制代码 代码如下:
//返回值给父窗体
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 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 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);
}
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product