Recently on the Internet a lot about how to control in the parent window only a child window problem, I looked at some, most of them can only be solved part or very troublesome, not perfect. For example, someone is implementing this, using a cookie, and here's an example.
The home page has a pop-up window, how to make it pop only once, return to the home page no longer pop-up.
---------------------------------------------------------------
<body onload= "Checkcount ()" >
This is the Internet casually picked an example, is not a lot of it is difficult to understand, I would like to say a new method, to ensure good looks.
<script language= "JavaScript" type= "Text/javascript" >
<!--Copyright Fenggang at 2007/3/23
var w=null;
function Mm_openbrwindow (theurl,winname,features) {//v2.0
if (W!=undefined&&isopen ()) {
W.close ();
}
W=window.open ("", winname,features);
W.location.replace (theURL);
}
function IsOpen ()
{
Try
{
W.document;
return true;
}
catch (ex)
{}
return false;
}
-->
</script>
This Mm_openbrwindow () function name is the pop-up function name that is commonly used in Dreamweaver, and this code is put into the page
Then do pop-up windows can only explore a window, the above is the essence of the section, the following is a complete test page code, try it.
<% @LANGUAGE = "VBSCRIPT" codepage= "936"%>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Untitled Document </title>
<script language= "JavaScript" type= "Text/javascript" >
<!--Copyright Fenggang at 2007/3/23
var w=null;
function Mm_openbrwindow (theurl,winname,features) {//v2.0
if (W!=undefined&&isopen ()) {
W.close ();
}
W=window.open ("", winname,features);
W.location.replace (theURL);
}
function IsOpen ()
{
Try
{
W.document;
return true;
}
catch (ex)
{}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.