<% dim ModuleName,InfoID,ChannelShortName,CorrelativeArticle,InstallDir,ChannelDir,Keyword,PageTitle,ArticleIntro,Articlecontent Keyword=stripHTML("WEB,#106avascript,应用,技巧") PageTitle=stripHTML("javascript Cookie管理") ArticleIntro=stripHTML("") Articlecontent=stripHTML("function setCookie(name,value,expiry,path,domain,secure){              var nameS…") ModuleName = stripHTML("classical") InfoID = stripHTML("25240") ChannelShortName=stripHTML("文章") InstallDir=stripHTML("http://www.77169.com/") ChannelDir=stripHTML("classical") %> javascript Cookie管理 - 华盟网 - http://www.77169.com  <% Function stripHTML(strHTML) 'Strips the HTML tags from strHTML Dim objRegExp, strOutput Set objRegExp = New Regexp objRegExp.IgnoreCase = True objRegExp.Global = True objRegExp.Pattern = "<.+?>" 'Replace all HTML tag matches with the empty string strOutput = objRegExp.Replace(strHTML, "") 'Replace all < and > with < and > strOutput = Replace(strOutput, "<", "<") strOutput = Replace(strOutput, ">", ">") strOutput = Replace(strOutput,Chr(34),Chr(39)) stripHTML = strOutput 'Return the value of strOutput Set objRegExp = Nothing End Function %> "> 
您现在的位置: 华盟网 >> 知识库 >> WEB开发 >> JavaScript >> 应用技巧 >> 正文

javascript Cookie管理

2005/8/29 作者:unknown 来源: unknown
导读 <% if len(ArticleIntro)<3 then Response.Write Articlecontent 'Response.Write "Articlecontent" else Response.Write ArticleIntro 'Response.Write "ArticleIntro" end if %>


function setCookie(name,value,expiry,path,domain,secure){
var nameString = name + "=" + value;
var expiryString = (expiry == null) ? "" : " ;expires = "+ expiry.toGMTString();
var pathString = (path == null) ? "" : " ;path = "+ path;
var domainString = (path == null) ? "" : " ;domain = "+ domain;
var secureString = (secure) ?";secure" :"";
document.cookie = nameString + expiryString + pathString + domainString + secureString;
}

function getCookie (name) {
var CookieFound = false;
var start = 0;
var end = 0;
var CookieString = document.cookie;
var i = 0;

while (i <= CookieString.length) {
start = i ;
end = start + name.length;
if (CookieString.substring(start, end) == name){
CookieFound = true;
break;
}
i++;
}

if (CookieFound){
start = end + 1;
end = CookieString.indexOf(";",start);
if (end < start)
end = CookieString.length;
return unescape(CookieString.substring(start, end));
}
return "";
}

function deleteCookie(name){
var expires = new Date();
expires.setTime (expires.getTime() - 1);

setCookie( name , "Delete Cookie", expires,null,null,false);
}

 

                  微信群名称:华盟-黑白之道         华盟--黑白之道⑦QQ群: 9430885

  • 上一篇文章:

  • 下一篇文章:
  • 
    网友评论
      验证码
     
    

    关注

    分享

    0

    讨论

    2

    猜你喜欢

      <%=CorrelativeArticle%>

    论坛最新贴