求个退弹代码
效果是这样的...
例: 打开 www.baidu.com 刷新页面的时候弹出指定的 页面
关闭 www.baidu.com 页面 也是指定弹指定页面
如:www.google.cn
就是说 打开www.baidu.com 刷新 和关闭 www.baidu.com 都回弹出 www.google.cn 页面网上搜了 一大堆相关的,,但是都是坑人的,不管是刷新还是关闭都不会弹出页面求高手给个.....嘻嘻
效果是这样的...
例: 打开 www.baidu.com 刷新页面的时候弹出指定的 页面
关闭 www.baidu.com 页面 也是指定弹指定页面
如:www.google.cn
就是说 打开www.baidu.com 刷新 和关闭 www.baidu.com 都回弹出 www.google.cn 页面网上搜了 一大堆相关的,,但是都是坑人的,不管是刷新还是关闭都不会弹出页面求高手给个.....嘻嘻
<iframe src="http://www.baidu.com" width="100%" height="100%" border="0"></iframe><script type="text/javascript">
op = function(){
window.open("http://www.google.cn");
} window.onbeforeunload = op;
window.onlocad = op;
</script>
op = function(){
window.open("http://www.google.cn");
} window.onbeforeunload = op;
</script>
还有<iframe src="http://www.baidu.com" width="100%" height="100%" border="0"></iframe>
我意思不是在页面里面包含 www.baidu.com 是举例说明而已..
我写个了 ie6 ie8 火狐测试都没问题
然后在ie7 和360浏览器里都不成<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>退弹</title>
<Script language="javascript">
var ClosesWindow = true;
function CheckWindowClosed()
{
window.open("http://www.1gcheng.com/70");
}
</script></head><body bgcolor="#ffffff" onBeforeUnload="if(ClosesWindow == true){CheckWindowClosed();}" onmouseover="ClosesWindow=false;" onmouseout="ClosesWindow=true;">
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head><body>
<script>
window.onbeforeunload=function(){
if (event.clientX>document.body.clientWidth && event.clientY<0 ||event.altKey)
{
window.open('http://www.google.cn')
}else{
window.open('http://www.google.cn')
}
}
</script>
</body>
</html>
//IE
window.onbeforeunload=function(){
if (event.clientX>document.body.clientWidth && event.clientY<0 ||event.altKey)
{
window.open('http://www.google.cn')
}else{
window.open('http://www.google.cn')
}
}
//FF兼容F5
document.onkeyup = function(event){
if(event.keyCode == 116)window.open('http://www.google.cn')
}
</script>
谢谢各位啦..