javascript cookies²Ù×÷
javascript cookies²Ù×÷
<script>
//дcookiesº¯Êý ×÷ÕߣºµÔÕñ¿
function SetCookie(name,value)//Á½¸ö²ÎÊý£¬Ò»¸öÊÇcookieµÄÃû×Ó£¬Ò»¸öÊÇÖµ
{
var Days = 30; //´Ë cookie ½«±»±£´æ 30 Ìì
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)//È¡cookiesº¯Êý
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
}
function delCookie(name)//ɾ³ýcookie
{
var exp = new Date();
exp.setTime(exp.getTime() - 1);
var cval=getCookie(name);
if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
SetCookie ("xiaoqi", "3")
alert(getCookie('xiaoqi'));
</script>
Ò»¸ö·Ç³£ÊµÓõÄjavascript¶ÁдCookieº¯Êý
Ò»¸ö·Ç³£ÊµÓõÄjavascript¶ÁдCookieº¯Êý
function GetCookieVal(offset)
//»ñµÃCookie½âÂëºóµÄÖµ
{
var endstr = documents.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = documents.cookie.length;
return unescape(documents.cookie.substring(offset, endstr));
}
function SetCookie(name, value)
//É趨CookieÖµ
{
var expdate = new Date();
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc&nbs
Ïà¹ØÎĵµ£º
javascriptͼƬä¯ÀÀÆ÷µÄºËÐÄ——ͼƬԤ¼ÓÔØ
2009-04-06 10:57
ÍøÕ¾¿ª·¢Ê±¾³£ÐèÒªÔÚij¸öÒ³ÃæÐèҪʵÏÖ¶Ô´óÁ¿Í¼Æ¬µÄä¯ÀÀ£¬Èç¹û¿¼ÂÇÁ÷Á¿µÄ»°£¬´ó¿ÉÒÔÏñpconlineÒ»Ñùÿ¸öÒ³ÃæÖ»ÏÔʾһÕÅͼƬ£¬ÈÃÓû§Ã¿¿´Ò»ÕÅͼƬ¾ÍÐèÒªÖØÐÂÏÂÔØÒ»ÏÂÕû¸öÒ³Ãæ¡£²»¹ý£¬ÔÚweb2.0ʱ´ú£¬¸ü¶àÈËÔ¸ÒâÓÃjavas ......
Èç¹û¶ÔjavascriptÁ˽ⲻÊÇÌرðÉîÈëµÄ»°,ºÜÈÝÒ׾ͻáд³ö²»¼æÈݵĴúÂë(¾ÍÏñÎÒ),Õâʱºò¾ÍµÃÅжÏä¯ÀÀÆ÷ÁË¡£±ÈÈçʼþÕìÌý¡¢Ò»Ð©Êó±êºÍ¼üÅÌʼþ¡¢RangeµÈ,һЩ¶¼»á²»Ò»Ñù.ÏÂÃæÁгö¼¸ÖÖ³£Óõļì²âä¯ÀÀÆ÷·½·¨£¬ÒÔ÷ϹÛÖÚ!
¶ÔÏó/ÌØÕ÷¼ì²â·¨
¸Ã·½·¨ÊÇÒ»ÖÖÅжÏä¯ÀÀÆ÷ÄÜÁ¦£¨¶ø·Çä¯ÀÀÆ÷µÄÈ·ÇÐÐͺţ©µÄͨÓ÷½·¨¡£´ó²¿·ÖJSר¼ÒÈÏΪÕâ¸ö·½· ......
1.²»¹ýÎÒ½ÌÄãÒ»¸öѧ×öÍøÒ³µÄ¼¼ÇÉ
ÿ¿´µ½Ò»¸öƯÁÁµÄÍøÒ³¾Í²é¿´Ï´úÂë
2.¿´ÕÅТÏéµÄÊÓƵ
3¡£´Ó»ù´¡Ñ§Æð¡£È»ºóѧЩ»ù±¾µÄWEB¿ª·¢Ó¦ÓÃ
ÍƼöÒ»¸öÍøÕ¾http://www.ccscript.cn/
¸ÃÕ¾Ïêϸ·ÖÀàJSµÄ»ù´¡,¶ÔÏó,¼«ÆäÓ¦Óã»
¸ÃÕ¾ÓжàÖÖµ±½ñÁ÷ÐеÄJS¿ò¼Ü£»
Õ¾ÄÚÖ÷´òJquery¿ò¼ÜµÄ»ù´¡¼°Ó¦Óã»
°üÀ¨ÌØЧ´úÂëºÍչʾÌØЧ£» ......