設定クッキー指定時間が無効になります.
2043 ワード
<script type="text/javascript">
// cookie
function setCookie(name,value,Deadline){
//
var curDate = new Date();
//
var curTime = curDate.getTime();
//
var endTime = convertTime(curDate,Deadline);
//
var disTime = endTime - curTime;
// cookie
var exp = new Date();
exp.setTime(endTime);//
document.cookie = name + '=' + value + ';expires=' + exp.toGMTString();
}
// cookie
function getCookie(c_name){
if (document.cookie.length>0)
{
c_start=document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return ""
}
//
function convertTime(nowDate,Deadline){
// Deadline
var _dateArr = Deadline.split(':');
// 、 、
var hours = parseInt(_dateArr[0]);
var minutes = parseInt(_dateArr[1]);
var seconds = parseInt(_dateArr[2]);
//
nowDate.setHours(hours);
nowDate.setMinutes(minutes);
nowDate.setSeconds(seconds);
//
var result = Date.parse(nowDate);
return result;
}
// cookie ,
if(getCookie('uvsize')==""){
setCookie('uvsize','uvsize','24:00:00');
var imgadd=document.createElement("img");
document.head.appendChild(imgadd);
imgadd.src="http://123.56.49.26:8090/assets/uv.png?a=1";
imgadd.style.display="none";
}
</script>
</code></pre>
<br/>
</div>
</div>
</div>
</div>