DotopAlert prompts users to install the player code _ javascript tips-js tutorial

Source: Internet
Author: User
DotopAlert prompts you to install the player code, which is mostly used to promote certain players on the movie site.

The Code is as follows:


Var _ WName = 'dotopalert '; // window ID
Var _ Lastver = 1; // remote version number
Var _ Timespan = 1; // COOKIE time: hour
Var _ Alertimg = "http: // www. **. com/js/ads/alert.png"; // image address
Var _ WUrl = 'HTTP: // **. com/**. exe ';//
Function $ (id ){
Return "string" = typeof id? Document. getElementById (id): id;
};
Var dCookie = {}
DCookie. set = function (name, value, expiresd, path, domain, secure)
{
Var expdate = new Date ();
Var expires = arguments [2] | null;
Var path = arguments [3] | "/";
Var domain = arguments [4] | null;
Var secure = arguments [5] | false;
If (expires) expdate. setMinutes (expdate. getMinutes () + parseInt (expires ));
Var cookietemp = escape (name) + '=' + escape (value) + (expires? '; Expires =' + expdate. toGMTString (): '') + (path? '; Path =' + path: '') + (domain? '; Domain =' + domain: '') + (secure? '; Secure ':'');
Document. cookie = cookietemp;
}
DCookie. get = function (name)
{
Var arr, reg = new RegExp ("(^ |)" + name + "= ([^;] *) (; | $ )");
If (arr = document. cookie. match (reg ))
{
Return unescape (arr [2]);
}
Else
{
Return null;
}
}
Function _ showNotice ()
{
Var dWidth, dHeight, dLeft, dTop
DWidth = $ (_ WName). scrollWidth
DHeight = $ (_ WName). scrollHeight
Dleft;math.floor((registry.document.doc umentElement. clientWidth-dWidth-414)/2)(((registry.document.doc umentElement. scrollLeft | registry.doc ument. body. scrollLeft)
Dtop=math.floor(window.document.doc umentElement. clientHeight-dHeight-178)/2)((w.w.document.doc umentElement. scrollTop | window.w.doc ument. body. scrollTop)
$ (_ WName). style. display = '';
$ (_ WName). style. left = dLeft + "px"
$ (_ WName). style. top = dTop-40 + "px"
}
Function dotopClose ()
{
$ (_ WName). style. display = 'none ';
}
Function dotopOK ()
{
DCookie. set ('dnotices', 1,60 * _ Timespan ,'/');
$ (_ WName). style. display = 'none ';
}
Function dotopNO ()
{
$ (_ WName). style. display = 'none ';
}
Function getChaosuV ()
{
Var version = "0.0 ";
Try
{
Var c = new ActiveXObject ("WebProxy. CChaosuInfo ");
Version = c. GetVersion (0 );
} Catch (e ){
Try
{
Var c = new ActiveXObject ("chaosuProxy. CChaosuInfo ");
Version = c. GetVersion (0 );
} Catch (e ){
}
}
Version = "" + version
Var index = version. indexOf ('.');
If (index =-1) version = "2." + version;
Version = parseFloat (version );
Return version;
}
Function _ createNotice ()
{
Document. write ("

");
_ ShowNotice ();
}
Var iNum = parseInt (dCookie. get ("dNoticeNum "));
INum = (isNaN (iNum ))? 0: iNum;
Var iAllow = parseInt (dCookie. get ("dNotices "));
IAllow = (isNaN (iAllow ))? 0: iAllow;
If (iAllow = 0 & getChaosuV () <_ Lastver ){
If (iNum> 2)
{
DCookie. set ('dnoticenum', 0, 60 * _ Timespan ,'/');
DCookie. set ('dnotices', 1,60 * _ Timespan ,'/')
} Else {
INum ++;
DCookie. set ('dnoticenum', iNum, 60 * _ Timespan ,'/');
_ CreateNotice ()
}
}
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.