网页顶端显示消息
var cookiename=getCookie("screentopdiv");
if (cookiename == "0") {
document.write(‘<div id="screentopdiv" style=" text-align: center; font-size: 14px; padding: 5px 0; background-color: rgb(232, 72, 72); color: white;">Dear Customers, your order may will be delayed 1-3 days due to the strict inspections by customs in HK. <span style="float:right;margin-right: 5px;"> </span> <span onclick="closetopdiv()" style="float:right;cursor: pointer;-webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1);">+</span></div>‘);
}
else {
if(document.getElementById("screentopdiv"))
document.getElementById(‘screentopdiv‘).style.display = "none";
}
function closetopdiv() {
document.getElementById(‘screentopdiv‘).style.display = "none";
addCookie("screentopdiv", "1", 0);
}
function addCookie(objName,objValue,objHours){//添加cookie
var str = objName + "=" + escape(objValue);
if(objHours > 0){//为0时不设定过期时间,浏览器关闭时cookie自动消失
var date = new Date();
var ms = objHours*3600*1000;
date.setTime(date.getTime() + ms);
str += "; expires=" + date.toGMTString();
}
document.cookie = str;
}
function getCookie(objName){//获取指定名称的cookie的值
var arrStr = document.cookie.split("; ");
for(var i = 0;i < arrStr.length;i ++){
var temp = arrStr[i].split("=");
if(temp[0] == objName)
return unescape(temp[1]);
}
return "0";
}
function delCookie(name){//为了删除指定名称的cookie,可以将其过期时间设定为一个过去的时间
var date = new Date();
date.setTime(date.getTime() - 10000);
document.cookie = name + "=a; expires=" + date.toGMTString();
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。