Copy codeThe Code is as follows:
Function jb51tuitan (){
If (getCookie ('jb51popped') = ''){
// Code or operations to be executed
SetCookie ("jb51popped", "OK"); // write cookies to indicate that the cookie has been executed.
Alert ("OK ");
}
}
Jb51tuitan ()
Function setCookie (name, value)
{
Var argv = setCookie. arguments;
Var argc = setCookie. arguments. length;
Var expires = (argc> 2 )? Argv [2]: null;
If (expires! = Null)
{
Var LargeExpDate = new Date ();
LargeExpDate. setTime (LargeExpDate. getTime () + (expires * 1000*3600*24 ));
}
Document. cookie = name + "=" + escape (value) + (expires = null )? "": ("; Expires =" + LargeExpDate. toGMTString ()));
}
Function getCookie (Name)
{
Var search = Name + "="
If (document. cookie. length> 0)
{
Offset = document. cookie. indexOf (search)
If (offset! =-1)
{
Offset + = search. length
End = document. cookie. indexOf (";", offset)
If (end =-1) end = document. cookie. length
Return unescape (document. cookie. substring (offset, end ))
}
Else return ""
}
}
Put the content you want to output in the judgment statement in the jb51tuitan () function.