自寫簡單JS判斷是否已經彈出頁面
更新時間:2010年10月20日 15:14:42 作者:
朋友要做個廣告彈出記錄,不能用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://sc.jb51.net','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>
復制代碼 代碼如下:
<!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://sc.jb51.net','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>
相關文章
javascript實現(xiàn)的多條新聞公告系統(tǒng)
javascript實現(xiàn)的多條新聞公告系統(tǒng)...2007-08-08基于innerHTML中的script廣告實現(xiàn)代碼[廣告全部放在一個js里面]
基于innerHTML中的script廣告實現(xiàn)代碼 ,主要是為了統(tǒng)一管理廣告,但因為innerHtml的script的一些問題不建議script的代碼下面是一些測試。2009-09-09用js實現(xiàn)的一個Flash滾動輪換顯示圖片代碼生成器
用js實現(xiàn)的一個Flash滾動輪換顯示圖片代碼生成器...2007-03-03