日期:2014-05-16 浏览次数:20422 次
<script language="javascript" type="text/javascript"> window.onbeforeunload=function window.onbeforeunload() { if (event.clientX>document.body.clientWidth && event.clientY<0||event.altKey) { window.event.returnValue="确认结束当前会话?"; } } </script>
------解决方案--------------------
前台JS方法
<script language="javascrip" type="text/javascript"> function load() { var ua = navigator.userAgent; var ie = navigator.appName == "Microsoft Internet Explorer" ? true:false; if (ie) { var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE ")))); if (IEversion< 5.5) { var str = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'; str += '<param name="Command" value="Close"></object>'; document.body.insertAdjacentHTML("beforeEnd", str); document.all.noTipClose.Click(); } else { var butten1= document.getElementById("Button1"); butten1.click(); alert("已退出系统");//此句必须要 不然关闭时间太短也不起作用(我还没有想到好的方法解决) window.opener = null; window.close(); } } else { window.close(); } } </script>
------解决方案--------------------
<script type="text/javascript">
<!--
function getBO()
{
ret = confirm("你是否要关闭窗口");
if(ret)
{
external.addFavorite('网址','收藏名称') ;
window.close();
}
}
</script>