日期:2014-05-16  浏览次数:20345 次

window.open 打开页面 同时执行新页面中的函数
<script   type= "text/javascript ">
function   goToSetSign()
{
opn=window.open( '/User/usermain.aspx ');
opn.onload=opn.test();
}
</script>

但是总是说没有test函数,请问正确的怎么写

------解决方案--------------------
哈,俺也试了试,确实不行,因为页面加载需要时间!

用延时吧!俺试了可以的!

L@_@K


<body>
<script type= "text/javascript ">
<!--
var opn=window.open( 'p1.html '); // 根据实际修改
var numTimerId;
function CallChildFunc()
{
if (opn.test)
{
opn.test();
window.clearInterval(numTimerId);
}
}
numTimerId = window.setInterval(CallChildFunc, 10);
//opn.onload = opn.test;
//-->
</script>
</body>