自写简单JS判断是否弹出页面

朋友要做个广告弹出记录,不能用COOKIE记录是否弹出,用判断返回值跟判断是否窗口最小化记录不准确,
自己写了以下简单的JS判断是否弹出页面不知道朋友那里能记录不,希望对用的住的人有所帮助

代码如下:

<!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=utf-8" />
<title>无标题文档</title>
</head>
<script language="JavaScript1.2" type="text/JavaScript1.2">
var test=0;
function testShowWindow()
{
//禁用了activex控件你就不记录哈
if(test)
{
if(!test.closed){
alert('窗口弹出了');

test.close();
}else{
alert('没有弹出噶');
}
}
//这个你加到 没有弹出时再弹出看看呢 
test = window.open('http://www.sc4888.com','test','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=no,copyhistory=yes,width=400,height=600,left=100,top=100');

//这里你可以记录哈 (可在弹出时记录)  
}
</script>
</head>
<body>
<a href="#" onClick="javascript:testShowWindow();"><input type="button" name="" value="弹出窗口" onClick="javascript:testShowWindow();"></a>

<body>
</body>
</html>

posted @ 2010-10-18 10:54  阿童木  阅读(803)  评论(0编辑  收藏  举报