子页面控制父页面打开新页面 A在浏览器地址是显示a.htmlB是由A上的方法window.open('b.html')当关闭b.html 浏览器的地址变成c.html并打开 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 var i = window.open("test.html"); window.onblur = function(){ parent.location.href = "http://www.google.com.hk"; }; 如果是window.open打开的新窗口的话,也就没有parent.了吧,感觉不好使wan window.opener.location.href = 'xx.html' var i = window.open("test.html");window.onblur = function(){window.opener.location.href = "http://www.google.com.hk";}; 有一个winodw.onunload方法 不过无法判断是刷新还是关闭页面 a.html<html><script> function doSomething() { window.open("b.html"); }</script><body> <input type="button" onclick="doSomething()"/></body><html>b.html<html><script> window.onunload=function(){window.opener.location = "http://www.baidu.com";}</script><body> <input type="button" onclick="doSomething()"/></body><html>注意。这个是在IE下工作的,别的浏览器是不支持操作父窗口的 chorme里我用jquery取不到第n个tr下的第二个子元素td底下的a的class javascript 网站整合登陆问题,请各老大指教一下 使用CSS还是DOM还是其它js库? 请教js做一个三个按钮的对话框 急急急 雅虎的站内搜索代码 这段代码怎么无法运行 asp中的instr函数 在javascript中是哪个函数? 一个小问题 急待解决 哪里有javascript源代码方面的站点. 再问一下(julyclyde(Clyde)) js怎么跨框架操作控件 让图片不间断向上滚动,它会过一会停止,想让它永不停止,帮修改
window.onblur = function(){
parent.location.href = "http://www.google.com.hk";
};
也就没有parent.了吧,
感觉不好使wan
window.onblur = function(){
window.opener.location.href = "http://www.google.com.hk";
};
<script>
function doSomething()
{
window.open("b.html");
}
</script>
<body>
<input type="button" onclick="doSomething()"/>
</body>
<html>b.html
<html>
<script>
window.onunload=function(){window.opener.location = "http://www.baidu.com";}
</script>
<body>
<input type="button" onclick="doSomething()"/>
</body>
<html>注意。这个是在IE下工作的,别的浏览器是不支持操作父窗口的