On
On
window.on
window.on
function on
var warning="确认退出?";
return warning;
}
function on
var warning="谢谢光临";
alert(warning);
}
这段代码在FF和IE上都能正确执行.再点击关闭按钮时首先触发obbeforeunload事件,点击否定时不执行on
这里一并推荐一个ActionScript3的好教程:http://gskinner.com/talks/as3workshop 写道运用on
view plaincopy to clipboardprint?
function CloseOpen(event) {
if(event.clientX<=0 && event.clientY<0) {
alert("关闭");
}
else
{
alert("刷新或离开");
}
}
function CloseOpen(event) {
if(event.clientX<=0 && event.clientY<0) {
alert("关闭");
}
else
{
alert("刷新或离开");
}
}
另外一种判断刷新和关闭的方法
view plaincopy to clipboardprint?
window.on
{
var n = window.event.screenX - window.screenLeft;
var b = n > document.documentElement.scrollWidth-20;
if(b && window.event.clientY < 0 || window.event.altKey)
{
alert("是关闭而非刷新");
window.event.returnValue = ""; //这里可以放置你想做的操作代码
}else
{
alert("是刷新而非关闭");
}
}
window.on
{
var n = window.event.screenX - window.screenLeft;
var b = n > document.documentElement.scrollWidth-20;
if(b && window.event.clientY < 0 || window.event.altKey)
{
alert("是关闭而非刷新");
window.event.returnValue = ""; //这里可以放置你想做的操作代码
}else
{
alert("是刷新而非关闭");
}
}