js 获取father_js父子窗口传值以及当前页面在js前台如何获得url参数

1.首先是父页面用window.open打开窗口

function openChild() {

var k = window.open('WebForm2.aspx?id=110&id1=120&id3=130', 'newwindow', 'height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');

//window.showModalDialog("/WebForm2.aspx", "obj", "dialogWidth:335px;status:no;dialogHeight:300px");

}

2.这是子页面

window.onload = function() {

var k = window.opener;

document.getElementById("txt1").value = k.document.getElementById("txt10").value;

var url = location.search;

if (url.indexOf("id3")!=-1) {

alert("url id3");

}

var theRequest = new Object();

if (url.indexOf("?") != -1) {

var str = url.substr(1);

strs = str.split("&");

for (var i = 0; i < strs.length; i++) {

theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);

}

}

};

function setFather() {

//给父窗口空间传值

var k = window.opener;

k.document.getElementById("txt10").value =

document.getElementById("txt1").value;

}

//设置返回到父窗口的值

function  retrunValue() {

var s =

document.getElementById("txt2").value;

window.returnValue = s;

window.close();

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值