| Javascript | | copy | | ? |
| 01 | /** |
| 02 | * 设置cookies |
| 03 | */ |
| 04 | function setCookie(c_name,value,expiredays) |
| 05 | { |
| 06 | var exdate=new Date() |
| 07 | exdate.setDate(exdate.getDate()+expiredays) |
| 08 | document.cookie=c_name+ "=" +escape(value)+ |
| 09 | ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()) |
| 10 | } |
| 11 | /** |
| 12 | * 获取cookies |
| 13 | */ |
| 14 | function getCookie(c_name) |
| 15 | { |
| 16 | if (document.cookie.length>0) |
| 17 | { |
| 18 | c_start=document.cookie.indexOf(c_name + "=") |
| 19 | if (c_start!=-1) |
| 20 | { |
| 21 | c_start=c_start + c_name.length+1 |
| 22 | c_end=document.cookie.indexOf(";",c_start) |
| 23 | if (c_end==-1) c_end=document.cookie.length |
| 24 | return unescape(document.cookie.substring(c_start,c_end)) |
| 25 | } |
| 26 | } |
| 27 | return ""; |
| 28 | } |
还没有任何评论。
Leave a comment!
<< PHPDOC 注释的用法

