HTML 页面关闭前处理
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-31j">
<script type="text/javascript">
window.onbeforeunload=test;
function test()
{
var checkboxlist = document.getElementsByName("ck");
var seqIDStr = "";
for(i = 0;i<checkboxlist.length;i++){
if(checkboxlist[i].checked){
alert("are you sure leave this page?");
return;
}
}
}
</script>
<title>Insert title here</title>
</head>
<body>
<select name="carrier">
<option value=""></option>
<option value="IPHONE" selected>IPHONE</option>
<option value="ANDROID" selected="selected">ANDROID</option>
</select>
<input type="checkbox" name="ck"/>sss
<input type="checkbox" name="ck"/>sss
<input type="checkbox" name="ck"/>sss
<input type="checkbox" name="ck"/>sss
<input type="checkbox" name="ck"/>sss
<input type="checkbox" name="ck"/>sss
<input type="checkbox" name="ck"/>sss
<a href="t.html?d">ssss</a>
</body>
</html>