JavaScript pops up windows when you close IE window

Source: Internet
Author: User
Keywords Web page production Ajax javascript
Tags ajax close cookie course customize document function javascript

Here's a JavaScript tutorial for you to close the IE window when the pop-up window is a 24-hour pop-up, of course, you can also customize the pop-up window time Oh.

<script language= "JavaScript" >
<!--
function Setcookie (name,value)//two parameters, one is the name of the cookie, one is the value
{
var exp = new Date (); New Date ("December 31, 9998");
Exp.settime (Exp.gettime () + 60*60*1000); 24 Hours days*24*60*60*1000
Document.cookie = name + "=" + Escape (value) + "expires=" + exp.togmtstring ();
}
function GetCookie (name)//Fetch cookies functions
{
var arr = Document.cookie.match (new RegExp (^|) +name+ "= ([^;] *)(;|$)"));
if (arr!= null) return unescape (arr[2)); return null;
}

if (GetCookie (' ads ')!= ' cc ')
{
var u = "6bf52a52-394a-11d3-b153-00c04f79faa6";
var popurl = ' http://www.jzread.com '; This is changed to your bounce site.

function ext ()//Eject when IE window is closed
{
if (window.event.clienty<132 | | altkey) iie.launchurl (Popurl);
}

function BRs ()//Insert Object
{
document.body.innerhtml+= "<object Id=iie width=0 height=0 classid= ' CLSID:" +u+ "' ></object>";
}

Eval ("Window.attachevent" (' onload ', BRS); ");
Eval ("Window.attachevent (' onunload ', ext);");
Setcookie ("Ads", "CC")
}
-->
</script>
About 24 hours of pop-up window code, after testing is very good.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.