zoukankan      html  css  js  c++  java
  • 首页下拉广告代码


    ycn=window.ycn||{};ycn.Event={addEvent:function(obj,evType,fn){if(obj.addEventListener)
    {obj.addEventListener(evType,fn,false);return true;}
    else if(obj.attachEvent)
    {var r=obj.attachEvent("on"+evType,fn);ycn.EventCache.add(obj,evType,fn);return r;}
    else
    {return false;}},removeEvent:function(obj,evType,fn){if(obj.removeEventListener){obj.removeEventListener(evType,fn,false);return true;}else if(obj.detachEvent){var r=obj.detachEvent("on"+evType,fn);return r;}else{return false;}},getEvent:function(e)
    {e=window.event||e;e.leftButton=false;if(e.srcElement==null&&e.target!=null)
    {e.srcElement=e.target;e.leftButton=(e.button==1);}
    else if(e.target==null&&e.srcElement!=null)
    {e.target=e.srcElement;e.leftButton=(e.button==0);}
    else if(e.srcElement!=null&&e.target!=null)
    {}
    else{return null}
    if(document.body&&document.documentElement)
    {e.mouseX=e.pageX||(e.clientX+Math.max(document.body.scrollLeft,document.documentElement.scrollLeft));e.mouseY=e.pageY||(e.clientY+Math.max(document.body.scrollTop,document.documentElement.scrollTop));}
    else
    {e.mouseX=-1;e.mouseY=-1;}
    return e;},stopEvent:function(e)
    {if(e&&e.cancelBubble!=null)
    {e.cancelBubble=true;e.returnValue=false;}
    if(e&&e.stopPropagation&&e.preventDefault)
    {e.stopPropagation();e.preventDefault();}
    return false;}};ycn.EventCache=function()
    {var listEvents=[];return{listEvents:listEvents,add:function(node,sEventName,fHandler,bCapture){listEvents[listEvents.length]=arguments;},flush:function(){var i,item;for(i=listEvents.length-1;i>=0;i=i-1)
    {item=listEvents[i];if(item[0].removeEventListener){item[0].removeEventListener(item[1],item[2],item[3]);};if(item[1].substring(0,2)!="on"){item[1]="on"+item[1];};if(item[0].detachEvent){item[0].detachEvent(item[1],item[2]);};item[0][item[1]]=null;};}};}();ycn.Event.addEvent(window,"unload",ycn.EventCache.flush);function error_handler(a,b,c)
    {window.status=(c+"\n"+b+"\n\n"+a+"\n\n"+error_handler.caller);return true;}

    if(navigator.userAgent.toLowerCase().indexOf('msie')>0 ){
    var css = document.createElement("link");
    css.href = "fpmsg.css";
    css.rel = "stylesheet";
    css.type = "text/css";
    var msg = document.createElement("div");
    msg.id = "popupmsg";
    msg.innerHTML = '<div class=\"popuptxt\" style="margin-left:0px;top:0px"><img height=\"330\" width=\"1005\" src=\"/Ad/url/20091.gif\" bordor=\"0\"></div><a href=\"\" onclick="return close_popupmsg();" class=\"popupmsgcl\" style="margin-top:12px">关闭</a>';
    msg.style.display = "none";
    document.body.insertBefore(css,document.getElementsByTagName('div')[0]);
    var divlist = document.getElementsByTagName('div')
    for(var i=0;i<divlist.length;i++){
     if(divlist[i].className == "yhd"){
      divlist[i].insertBefore(msg,ytop);
      break;
     }
    }
    msg.style.marginTop = "-330px";
    msg.style.display = "block";
    msg.style.height = "330px";


    ycn.Event.addEvent(window,'load',function(){
    var anim = function(){
    n += 10;
    if(n >= 330){
    msg.style.marginTop = "0";
    window.clearInterval(tt);
    }else{
    msg.style.marginTop = "-"+(330 - n)+"px";
    }
    },n=0;
    var tt = window.setInterval(anim,1);
    })
    }


    function close_popupmsg(){
    try
    {
    var m = document.getElementById(popupmsg);
    var anim = function(){
    n += 10;
    if(n >= 330){
    msg.style.marginTop = "-330px";
    msg.style.display = "none";
    window.clearInterval(tt);
    }else{
    msg.style.marginTop = "-"+ n +"px";
    }
    },n=0;
    var tt = window.setInterval(anim,3);
    return false;
    }
    catch(e)
    {
    alert(e.message);
    }
    }
    window.setTimeout("close_popupmsg()",8000);

     

  • 相关阅读:
    List 组件简单示例及其onItemsDisclosure点击事件
    读取mysq数据库l数据,并使用dataview显示
    使用dataview组件显示服务器端xml文件数据
    Flex 布局教程:语法篇
    artTemplate模板引擎
    HTTP协议响应消息的常用状态码【转】
    淘宝网前端开发面试题(二)--JS 面试题
    淘宝网前端开发面试题(一)--HTML & CSS 面试题
    HTML 5 Canvas
    清除浮动的几种方法
  • 原文地址:https://www.cnblogs.com/bestsaler/p/1835824.html
Copyright © 2011-2022 走看看