帮我看看这段JS代码哪里有错误

来源:百度知道 编辑:UC知道 时间:2024/06/30 05:53:40
调整窗口大小,就会弹出警告
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JavaScript中的onResize事件</title>
<script language="javascript">
function notify()
{
alert("窗口的大小调整完毕!");
}
</script>
</head>

<body onresize="notify()">
</body>
</html>

但是,调整以后,会弹出3次警告。是固定的吗?如果要它只弹出一次,要怎么改

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JavaScript中的onResize事件</title>
<script language="javascript">
function setCookie(name,value){
document.cookie = name +'='+ escape(value);
}
function getCookie(name) {
var c = document.cookie.split('; ');
for ( var i=0; i<c.length; i++) {
var a = c[i].split( '=' );
if (a[0].toLowerCase()==name.toLowerCase())