离开当前页面前使用js判断条件提示是否要离开页面

时间:2014-05-02    点击:131   
复制代码 代码如下:

<!doctype html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>js离开当前页面前判断条件提示是否要离开页面</title>
<script type="text/javascript">
window.onbeforeunload = function()
{
var unloads = document.getElementById("unloads").value;
if(unloads == null || unloads == ""){
return "您确定要退出页面吗?";
}
}
</script>
</head>
<body>
<input type="text" id="unloads" name="unloads" value="" />
</body>
</html>
元素未显示设置width/height时IE中使用currentStyle获取为auto
JavaScript获取图片的原始尺寸以宽度为例
使用JavaScript获取电池状态的方法
JavaScript打印网页指定区域的例子
js检测输入内容全为空格的方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved