Welcome 微信登录

首页 / 脚本样式 / JavaScript / 自写简单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>