<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title><script type="text/javascript"> var
is_asked = false;
window.onbeforeunload =
function (ev) {
var e = ev || window.event;
window.focus();
if (!is_asked){
is_asked = true;
var showstr = "你喜欢我?";
if (e) {
e.returnValue = showstr;
}
return showstr;
}
}; window.onfocus =
function (ev){
if (is_asked){
window.location.href = "http://www.baidu.com";
}
}</script></head>
<body>
</body>
</html> 这效果是点击浏览器窗口右上角叉叉,有个弹出提示,(两个按钮)第一个按钮是确定关闭页面的,第二个按钮是地址跳转到百度www.baidu.com页面去的;
【需要效果: 想把这两个按钮的功能替换下;第一个按钮跳转到百度地址,第二个按钮确定关闭页面】{ 【 【 如果有别的javascript方法实现这个效果也可以,帮忙粘贴下 】 】 }
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title><script type="text/javascript"> var
is_asked = false;
window.onbeforeunload =
function (ev) {
var e = ev || window.event;
window.focus();
if (!is_asked){
is_asked = true;
var showstr = "你喜欢我?";
if (e) {
e.returnValue = showstr;
}
return showstr;
}
}; window.onfocus =
function (ev){
if (is_asked){
window.location.href = "http://www.baidu.com";
}
}</script></head>
<body>
</body>
</html> 这效果是点击浏览器窗口右上角叉叉,有个弹出提示,(两个按钮)第一个按钮是确定关闭页面的,第二个按钮是地址跳转到百度www.baidu.com页面去的;
【需要效果: 想把这两个按钮的功能替换下;第一个按钮跳转到百度地址,第二个按钮确定关闭页面】{ 【 【 如果有别的javascript方法实现这个效果也可以,帮忙粘贴下 】 】 }
话是这样说啊! 结果总是不如意啊; 帮忙修改下 看看效果如何?