zoukankan      html  css  js  c++  java
  • 新年网站添加 背景 + 右下角广告 JS

    <script type="text/javascript">// <![CDATA[
    document.write("<div id=\"divNewYear\" style=\"278px;height:225px;background:#221816; font-size:12px; color:White;\" >");
    document.write("<table style=\"border:none;\">");
    document.write("<tr><td style=\" line-height:14px;\">WILL祝您:新年快乐!<span style=\" float:right; cursor:pointer;\" onclick='document.getElementById(\"divNewYear\").style.display=\"none\";'>关闭<\/span><\/td><\/tr>");
    document.write("<tr><td><img src=\"http://www.tfxk.cn/WebCustomer/new.jpg\" /><\/td><\/tr><\/table><\/div>");
        function scrollx(p) {
            var d = document, dd = d.documentElement, db = d.body, w = window, o = d.getElementById(p.id), ie6 = /msie 6/i.test(navigator.userAgent), style, timer;
            if (o) {
                o.style.cssText += ";position:" + (p.f && !ie6 ? 'fixed' : 'absolute') + ";" + (p.l == undefined ? 'right:0;' : 'left:' + p.l + 'px;') + (p.t != undefined ? 'top:' + p.t + 'px' : 'bottom:0');
                if (p.f && ie6) {
                    o.style.cssText += ';left:expression(documentElement.scrollLeft + ' + (p.l == undefined ? dd.clientWidth - o.offsetWidth : p.l) + ' + "px");top:expression(documentElement.scrollTop +' + (p.t == undefined ? dd.clientHeight - o.offsetHeight : p.t) + '+ "px" );';
                    dd.style.cssText += ';background-image: url(about:blank);background-attachment:fixed;';
                } else {
                    if (!p.f) {
                        w.onresize = w.onscroll = function() {
                            clearInterval(timer);
                            timer = setInterval(function() {
                                //双选择为了修复chrome 下xhtml解析时dd.scrollTop为 0
                                var st = (dd.scrollTop || db.scrollTop), c;
                                c = st - o.offsetTop + (p.t != undefined ? p.t : (w.innerHeight || dd.clientHeight) - o.offsetHeight);
                                if (c != 0) {
                                    o.style.top = o.offsetTop + Math.ceil(Math.abs(c) / 10) * (c < 0 ? -1 : 1) + 'px';
                                } else {
                                    clearInterval(timer);
                                }
                            }, 10)
                        }
                    }
                }
            }
        }
        scrollx({
        id: 'divNewYear'
        })
        /*
        id 你要滚动的内容的id
        l 横坐标的位置 不写为紧贴右边
        t 你要放在页面的那个位置默认是贴着底边 0是贴着顶边
        f 1表示固定 不写或者0表示滚动
        */


        document.body.style.backgroundImage="url(http://www.tfxk.cn/WebCustomer/bg.jpg)";
        document.body.style.backgroundRepeat="repeat-x";
        document.body.style.backgroundPosition="center top";
        document.body.style.marginTop="40px";
    // ]]></script>

  • 相关阅读:
    Java深入学习31:ArrayList并发异常以及解决方案
    Java深入学习30:CAS中的ABA问题以及解决方案
    Java深入学习29:线程等待和唤醒的两个方案
    Redis学习05:Springboot集成Redis集群cluster
    项目总结66:Springboot项目继承kafka集群
    项目总结65:内存溢出OOM问题处理
    异常处理009:Windows10远程桌面连接提示:出现身份验证错误,要求的函数不受支持
    项目总结64:分别使用Redisson和Zookeeper分布式锁模拟模拟抢红包业务
    项目总结63:使用Spring AOP和BindingResult实现对接口的请求数据校验,并用@ExceptionHandler返回校验结果
    Java深入学习04:深入理解HashMap
  • 原文地址:https://www.cnblogs.com/lidingwen/p/1921361.html
Copyright © 2011-2022 走看看