<HTML> <HEAD> <SCRIPT> function closeIt() { event.returnValue = "Any string value here forces a dialog box to \ appear before closing the window."; } </SCRIPT> </HEAD> <BODY onbeforeunload="closeIt()"> <a href="http://www.microsoft.com">Click here to navigate to www.microsoft.com</a> </BODY> </HTML>
Teabrowser javascript usage:<script> window.onexit=function(){ // return true for continue; // return false for cancel; return confirm('Are you sure to exit the application'); } </script>
<head>
<script language="Javascript">
function winclose(){
/*在这里面写你要输入用户名和密码的部分*/
if(confirm("really?")){
window.close();
}
alert("111");
}
</script>
<head>
<body onbeforeunload="winclose();"></body>
</html>
用onbeforeunload的方法,这样才能实现密码正确则关闭否则不关闭
function ExitConfirm()
{
--询问
}
</script>
个人认为实现不了。
期待强人出现。
<script language="javascript">
function exitPage(){
//confirm
return false;//这个一定要
}
window.onbeforeunload = exitPage;
</script>
{
var password = window.prompt("请输入密码");
if(password!="正确密码")
{
window.open(window.location);
}
}<body onunload="windowLoad()">虽是假象,但是可以满足要求。阻止关闭是不可能了……
<head>
<title> test</title>
<script type="text/javascript">
<!--
window.onload=function(){
msg(document.body);
};
function msg(o){
o.onmousemove=function(a){
var d=document;if(!a)a=window.event;
if(o.setCapture)o.setCapture();
else if(window.captureEvents)window.captureEvents(Event.MOUSEDOWN|Event.KEYDOWN);
d.onmousedown=function()
{
if(event.srcElement==document.body){returnValue=false;return;}
else o.releaseCapture();
};
d.onkeydown=function()
{
if(event.srcElement==document.body){returnValue=false;return;}
else o.releaseCapture();
}; };
}
//-->
</script>
</head><body>
<input type="text">
</body>
</html>
<HEAD>
<SCRIPT>
function closeIt()
{
event.returnValue = "Any string value here forces a dialog box to \
appear before closing the window.";
}
</SCRIPT>
</HEAD>
<BODY onbeforeunload="closeIt()">
<a href="http://www.microsoft.com">Click here to navigate to
www.microsoft.com</a>
</BODY>
</HTML>
不然没法禁止人家关闭浏览器的
倒是可以的,可惜做不到吧
想想看,你无意打开一个网站,却不能关闭,这很无礼了。所以web应用与传统application,就是你不知道什么时候web应用退出.Teabrowser实现了一个事件 window.onexit 可实现相应的功能。
下载网址:
http://groups.google.com/group/teabrowser/web/TeaBrowser.zipjavascript usage:<script>
window.onexit=function(){}
</script>
window.onexit=function(){
// return true for continue;
// return false for cancel;
return confirm('Are you sure to exit the application');
}
</script>