在parent.html页面中打开 child.html页面。parent.html中有一个对象为userObject。在子页面child.html获取userObject的方式如下:
var url = “child.html”;
1 用window.open方式打开:window.open(url);
则在child.html中,window.opener.userObject 即可。
2 用window.showModelDialog方式打开:
window.showModalDialog(url, Arguments, sFeatures);
其中第二个参数就是打开child.html时要传递的参数,只要把Arguments 换成 userObject就可以了。如果想要添加多个参数,可以把Arguments定义为一个数组,将参数添加在
数组中。
则在child.html中,window.dialogArguments.userObject 即可。