Use cookies to collect Web sites

Source: Internet
Author: User
Tags date count setcookie
Do not always ask others whether the collection, annoying!
<script language= "JavaScript" >
<!--Begin
var expdays = 100;
url = "Http://softet.6to23.com";
title = "Come on";
function GetCookie (name) {
var arg = name + "=";
var alen = Arg.length;
var clen = document.cookie.length;
var i = 0;
while (I < Clen) {
var j = i + Alen;
if (Document.cookie.substring (i, j) = arg)
Return Getcookieval (j);
i = Document.cookie.indexOf ("", I) + 1;
if (i = = 0) break;
}
return null;
}
function Setcookie (name, value) {
var argv = setcookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2)? ARGV[2]: null;
var path = (argc > 3)? ARGV[3]: null;
var domain = (argc > 4)? ARGV[4]: null;
var secure = (argc > 5)? ARGV[5]: false;
Document.cookie = name + "=" + Escape (value) +
((expires = null)? "" : ("; Expires= "+ expires.togmtstring ()) +
((Path = null)? "" : ("; Path= "+ path)" +
(domain = null)? "" : ("; domain= "+ domain)" +
(Secure = = True)? "; Secure ":" ");
}
function Deletecookie (name) {
var exp = new Date ();
Exp.settime (Exp.gettime ()-1);
var cval = GetCookie (name);
Document.cookie = name + "=" + Cval + "; Expires= "+ exp.togmtstring ();
}
var exp = new Date ();
Exp.settime (Exp.gettime () + (expdays*24*60*60*1000));
Function Amt () {
var count = GetCookie (' count ')
if (count = = null) {
Setcookie (' Count ', ' 1 ')
Return 1
}
else {
var newcount = parseint (count) + 1;
Deletecookie (' count ')
Setcookie (' Count ', newcount,exp)
return count
}
}
function Getcookieval (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr = = 1)
Endstr = Document.cookie.length;
Return unescape (document.cookie.substring (offset, endstr));
}

function Checkcount () {
var count = GetCookie (' count ');
if (count = = null) {
Count=1;
Setcookie (' Count ', count, exp);

if ((navigator.appname = "Microsoft Internet Explorer") && (parseint (navigator.appversion) >= 4)) {
Window.external.AddFavorite (Url,title);
}
else {
var msg = "Don ' t forget to bookmark us!";
if (navigator.appname = = "Netscape") msg + + "(ctrl-d)";
Alert (msg);
}
}
else {
count++;
Setcookie (' Count ', count, exp);
}
}
Checkcount ();
End-->
</script>



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.