網頁頂端顯示訊息

來源:互聯網
上載者:User

標籤:style   color   io   os   ar   for   sp   div   on   

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;">&nbsp;</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();
}

網頁頂端顯示訊息

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.