作者:手机用户2602915671 | 来源:互联网 | 2023-09-09 17:33
代码如下:
function
phpstudytuitan(){
if (getCOOKIE(‘ph
pstudypopped’)==”){
//要执行的代码或一些操作
setCOOKIE(“phpstudypopped”,”ok”); //写入COOKIEs表示已经执行过了。
alert(“ok”);
}
}
phpstudytuitan()
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 “”
}
}
把想要输出的内容,放到phpstudytuitan()函数里面的判断语句里面即可。
—-想了解更多的linux相关异常处理怎么解决关注<编程笔记>