window.open 父页面向子页面传值

父页面:{

1、给标签赋值:document.getElementById("saveAddrTypeName").value=“xxxxx”;


2、 var url="<%=path%>/addressList/toInsert.do?type=";

window.open(url,'n<%=com.message.util.KeyGenerate.getUUID()%>','height=400, width=600,top='+(screen.availHeight-400)/2+', left='+(screen.availWidth-600)/2+',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no');





父页面body的input标签: id="saveAddrTypeName" value=""/>



//1、先给标签赋值,2、再用window.open打开子页面

}


子页面:{

function init(){
var opn=window.opener;
var parentName=opn.document.getElementById("saveAddrTypeName").value;//获取父页面标签的值

document.getElementById("addrTypeName").value=parentName; //给子页面标签赋值

}


}


你可能感兴趣的:(js,jsp)