好吧,我知道如何显示可关闭的置顶消息,但我想知道如何让它在 10 秒后关闭,并显示 10 秒计数器……以及如何赋予它悬停效果……这是我的可关闭置顶留言,仅供参考
<script>
function closeBox(toClose) {
document.getElementById(toClose).style.display = "none";setCookie(toClose,closed", 20);}
function setCookie(cName, value, expiredays) {var expDate = new Date();expDate.setDate(expDate.getDate()+expiredays);document.cookie=cName + "=" + escape(value) + ";expires=" + expDate.toGMTString();}
function loadMsg(msgClass) {msg = document.getElementsByTagName("div");for (i=0; i<msg.length; i++){if(msg[i].className == msgClass) {if(document.cookie.indexOf(msg[i].id) == -1) {msg[i].style.display = "block";}}}}
window.onload=function(){loadMsg('msgbox'); }
</script>
http://kownleg.blogspot.com
<style>
div.guestwarn {
background:#000000;
color:#FFFFFF;
max-width:280px;min-height:18px;padding:0 5px 3px;position:fixed;right: 2%;
top: 50%;padding: 10px 15px;position: fixed;z-index: 10;font-size:12px;-moz-border-radius: 8px; -webkit-border-radius: 8px; filter:alpha(opacity=88);
-moz-opacity:.88; opacity:.88; -moz-box-shadow:5px 5px 5px #191919; -webkit-box-shadow:5px 5px 5px #191919; box-shadow:5px 5px 5px #191919;
}
.close {float: right;background: transparent url(http://1.bp.blogspot.com/-hMdL9UJje_c/UA7nJADBTSI/AAAAAAAAABU/S5zftNPRxfs/s1600/close.png);width: 22px;height: 22px;}
</style>
<div id="message-1" class="msgbox" style="display: none;">
<div class="guestwarn"><a href="#" class="close" onclick="closeBox('message-1'); return false;" title=""></a>
**My Sticky Text Is Here**
</div>
</div>