zoukankan      html  css  js  c++  java
  • 浮动广告代码

    右下角漂浮代码
    <SCRIPT FOR=window EVENT=onload LANGUAGE="javascript">
    initAd();//载入页面后,调用函数initAd()
    </SCRIPT>
    <script language="javascript">
    <!--
    function initAd() {
    document.all.AdLayer.style.posTop = -200;
    //设置onLoad事件激发以后,广告层相对于固定后的y方向位置
    document.all.AdLayer.style.visibility = 'visible'//设置层为可见
    MoveLayer('AdLayer');//调用函数MoveLayer()
    }
    function MoveLayer(layerName) {
    var x = 0;//浮动广告层固定于浏览器的x方向位置
    var y = 300;//浮动广告层固定于浏览器的y方向位置
    var diff = (document.body.scrollTop + y - document.all.AdLayer.style.posTop)*.40;
    var y = document.body.scrollTop + y - diff;
    eval("document.all." + layerName + ".style.posTop = y");
    eval("document.all." + layerName + ".style.posright = x");//移动广告层
    setTimeout("MoveLayer('AdLayer');", 0);//设置20毫秒后再调用函数MoveLayer()
    }
    //-->
    </script>
    <!--下面为一个ID为AdLayer的层(如ID名不为AdLayer,
    上面MoveLayer()内的AdLayer也要作相应修改),包括一张带链接的图片-->
    <div id=AdLayer style='position:absolute; 200px; height:59px; z-index:20; visibility:hidden;; right: 10px; top: 100px'>
    <b>本人文学网站开通,欢迎大家赏脸光顾</b><br/>
    <a href="http://story.518east.com/Book/Detail/2009/09/01/24152.html" target="_blank">
    <img src="http://story.518east.com/images/logo.jpg" border="0">
    </a></div>




    漂浮广告代码

    <div id="www_qpsh_com" style="position:absolute">
    <b>本人文学网站开通,欢迎大家赏脸光顾</b>
    <a href="http://story.518east.com/Book/Detail/2009/09/01/24152.html" target="_blank">
    <img src="http://img03.518east.com/Story/2009911621301984.jpg" border="0">
    </a>
    </div>
    <script>
    var x = 50,y = 60
    var xin = true, yin = true
    var step = 1
    var delay = 10
    var obj=document.getElementById("www_qpsh_com")
    function floatwww_qpsh_com() {
    var L=T=0
    //by www.qpsh.com
    var R= document.body.clientWidth-obj.offsetWidth
    var B = document.body.clientHeight-obj.offsetHeight
    obj.style.left = x + document.body.scrollLeft
    obj.style.top = y + document.body.scrollTop
    x = x + step*(xin?1:-1)
    if (x < L) { xin = true; x = L}
    if (x > R){ xin = false; x = R}
    y = y + step*(yin?1:-1)
    if (y < T) { yin = true; y = T }
    if (y > B) { yin = false; y = B }
    }
    var itl= setInterval("floatwww_qpsh_com()", delay)
    obj.onmouseover=function(){clearInterval(itl)}
    obj.onmouseout=function(){itl=setInterval("floatwww_qpsh_com()", delay)}
    </script>

  • 相关阅读:
    小程序获知渠道弹出层设计
    小程序下拉菜单筛选
    align-conten和align-items的区别
    微信小程序文本如何换行
    微信小程序最新获取用户头像昵称的方法
    JQ版本对比
    选择收货地址列表的某一项将数据传到订单页面
    inline、block、inline-block属性的区别
    微博资料
    zookeeper知识点学习
  • 原文地址:https://www.cnblogs.com/cxd4321/p/1563263.html
Copyright © 2011-2022 走看看