页面下方从左向右移动的节日气氛图片

从左到右移动的圣诞节庆祝图标,JS代码:

<script language="javascript" type="text/javascript">    
(function() {
    if(new Date().getDate() !== 25) return;
    var sUrl = 'TempFile/christmas.gif';
        setTimeout(function() {
            var nWidth = document.body.scrollWidth - 342;//减去342是防止从页面右部出去的时候,出现横向滚动条
            var oImg = document.createElement("IMG");
            oImg.src = sUrl;
            oImg.border = 0;
            document.body.appendChild(oImg);
            oImg.style.position = "absolute";
            oImg.style.zIndex = 999;
            oImg.style.left = "-200px";
            oImg.style.bottom = "0px";
            oImg.title = "Merry Christmas!";
            var nTimer,f; 
            (function() {
                f = arguments.callee;
                nTimer = setTimeout(function() {
                    var nLeft = parseInt(oImg.style.left, 10);
                    if (nLeft > nWidth) {
                        document.body.removeChild(oImg);
                    } else {
                        oImg.style.left = nLeft + 5 + "px";
                        f();
                    }
                },
                50);
            })();
            $(oImg).bind("mouseover",
            function() {
                clearTimeout(nTimer);
            });
            $(oImg).bind("mouseout",
            function() {
                f();
            });
        },
        3000);
})();
</script>
原文地址:https://www.cnblogs.com/xyd21c/p/3491805.html