Example
s3=_lookup('username') //20140522
setCookie('ezERPusername',s3,365) //20140522
if (s)_refreshv2('username',s);//20140522
adoption getCookie
adoption setCookie
if (oldVariable_code!=newVariable_code){
company(CompanyCode,"NAME","company"); setCookie("VariableDescript",_lookup('company'),1);
oldVariable_code=newVariable_code;
}
function getCookie(c_name)
{
var c_value = document.cookie;
var c_start = c_value.indexOf(" " + c_name + "=");
if (c_start == -1) { c_start = c_value.indexOf(c_name + "="); }
if (c_start == -1) { c_value = null; }
else { c_start = c_value.indexOf("=", c_start) + 1;
var c_end = c_value.indexOf(";", c_start);
if (c_end == -1) {c_end = c_value.length;}
c_value = unescape(c_value.substring(c_start,c_end));}
return c_value;}
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}
沒有留言:
張貼留言