求右下角广告代码 可关闭,可缩小!如网站http://www.hzweixun.com/右下角给你留言小窗口

解决方案 »

  1.   


    <SCRIPT language=javascript>
    window.onload = enetgetMsg;
    window.onresize = enetresizeDiv;
    window.onerror = function(){}
    var enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight,enetdocHeight,enetdocWidth,enetobjTimer,i = 0;
    function enetgetMsg()
    {
    try{
    enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10)
    enetdivLeft = parseInt(document.getElementById("enetMeng").style.left,10)
    enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10)
    enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
    enetdocWidth = document.body.clientWidth;
    enetdocHeight = document.body.clientHeight;
    document.getElementById("enetMeng").style.top = parseInt(document.body.scrollTop,10) + enetdocHeight + 10;// enetdivHeight
    document.getElementById("enetMeng").style.left = parseInt(document.body.scrollLeft,10) + enetdocWidth - enetdivWidth
    document.getElementById("enetMeng").style.visibility="visible"
    enetobjTimer = window.setInterval("enetmoveDiv()",10)
    }
    catch(e){}
    }
     
    function enetresizeDiv()
    {
    i+=1
    if(i>800) enetcloseDiv() /自动关闭时间
    try{
    enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10)
    enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
    enetdocWidth = document.body.clientWidth;
    enetdocHeight = document.body.clientHeight;
    document.getElementById("enetMeng").style.top = enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10)
    document.getElementById("enetMeng").style.left = enetdocWidth - enetdivWidth + parseInt(document.body.scrollLeft,10)
    }
    catch(e){}
    }
    function enetmoveDiv()
    {
    try
    {
    if(parseInt(document.getElementById("enetMeng").style.top,10) <= (enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10)))
    {
    window.clearInterval(enetobjTimer)
    enetobjTimer = window.setInterval("enetresizeDiv()",1)
    }
    enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10)
    document.getElementById("enetMeng").style.top = enetdivTop - 1
    }
    catch(e){}
    }
    function enetcloseDiv()
    {
    document.getElementById('enetMeng').style.visibility='hidden';
    if(enetobjTimer) window.clearInterval(enetobjTimer)
    }
    </SCRIPT>
    <DIV id=enetMeng
    style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; LEFT: 0px; VISIBILITY: visible;BORDER-LEFT: #a6b4cf 1px solid; 1px solid; POSITION: absolute; TOP: -256px; HEIGHT: 100px">
    <a href="http://www.010996.com" target="_blank"><img src="http://www.010996.com/2g.jpg" width="180" height="120" alt="3D会员料已公开请点击查看"/></img>
    </div>
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>popup window </title>
    <style type="text/css"> 
    body { background:#333333;} 
    #winpop { width:200px; height:0px; position:absolute; right:0; bottom:0; border:1px solid #999999; margin:0; padding:1px; overflow:hidden;display:none; background:#FFFFFF} 
    #winpop .title { width:100%; height:20px; line-height:20px; background:#FFCC00; font-weight:bold; text-align:center; font-size:12px;} 
    #winpop .con { width:100%; height:80px; line-height:80px; font-weight:bold; font-size:12px; color:#FF0000; text-decoration:underline; text-align:center} 
    #silu { font-size:13px; color:#999999; position:absolute; right:0;bottom:0px; text-align:right; text-decoration:underline; line-height:22px;} 
    .close { position:absolute; right:4px; top:-1px; color:#FFFFFF; cursor:pointer} 
    </style> 
    <script type="text/javascript"> 
    function show_pop(){//显示窗口 
        document.getElementById("winpop").style.display="block"; 
        timer=setInterval("changeH(4)",2);//调用changeH(4),每0.002秒向上移动一次 

    function hid_pop(){//隐藏窗口 
        timer=setInterval("changeH(-4)",2);//调用changeH(-4),每0.002秒向下移动一次 

    //测试通过 
    function changeH(addH) { 
        var MsgPop=document.getElementById("winpop"); 
        var popH = 4;
    if (window.navigator.userAgent.indexOf("Firefox")>=1)
    {
    //alert(window.getComputedStyle(MsgPop,null).height);
    //return;
    popH = parseInt(MsgPop.style.height || window.getComputedStyle(MsgPop,null).height);
    }
        else
    {
    popH = parseInt(MsgPop.style.height || MsgPop.currentStyle.height);
    }
    //parseInt(MsgPop.style.height);//||MsgPop.currentStyle.height);//用parseInt将对象的高度转化为数字,以方便下面比较(JS读<style>中的height要用"currentStyle.height") 
        if (popH<=100&&addH>0||popH>=4&&addH<0){//如果高度小于等于100(str>0)或高度大于等于4(str<0) 
            MsgPop.style.height=(popH+addH).toString()+"px";//高度增加或减少4个象素 
        } 
        else{//否则 
            clearInterval(timer);//取消调用,意思就是如果高度超过100象素了,就不再增长了,或高度等于0象素了,就不再减少了 
            MsgPop.style.display=addH>0?"block":"none"//向上移动时窗口显示,向下移动时窗口隐藏(因为窗口有边框,所以还是可以看见1~2象素没缩进去,这时候就把DIV隐藏掉) 
        } 

    window.onload=function(){//加载 
    //setTimeout("show_pop()",800);//0.8秒后调用show_pop() 

    </script> </head>
    <body> 
    <div id="silu">
    <button onclick="show_pop()">测试按钮</button> 
    </div> 
    <div id="winpop"> 
        <div class="title">您有新的消息<span class="close" onclick="hid_pop()">X</span></div> 
    <div class="con"><a href='http://www.baidu.com'>测试</a></div> 
    </div> 
    </body>
    </html>
      

  3.   

    <html>
    <script language="JavaScript">
    <!--
    var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer;
    function getMsg()
    {
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
    docWidth = document.body.clientWidth;
    docHeight = document.body.clientHeight;
    document.getElementById("eMeng").style.top = docHeight + parseInt(document.body.scrollTop,10) + 5;
    document.getElementById("eMeng").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth ;
    document.getElementById("eMeng").style.visibility="visible";
    objTimer = window.setInterval("moveDiv()",10);
    }function resizeDiv()
    {
    divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10);
    divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10);
    docWidth = document.body.clientWidth;
    docHeight = document.body.clientHeight;
    document.getElementById("eMeng").style.top = docHeight + parseInt(document.body.scrollTop,10) - divHeight ;
    document.getElementById("eMeng").style.left = docWidth + parseInt(document.body.scrollLeft,10) - divWidth;
    }function moveDiv()
    {
    if(parseInt(document.getElementById("eMeng").style.top,10) < (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
    {
    window.clearInterval(objTimer);
    return;
    }
    divTop = parseInt(document.getElementById("eMeng").style.top,10);
    document.getElementById("eMeng").style.top = divTop - 2;
    }
    function closeDiv()
    {
    document.getElementById('eMeng').style.visibility="hidden";
    if(objTimer) window.clearInterval(objTimer);
    }
    window.onload = getMsg;
    window.onresize = resizeDiv;
    window.onscroll = resizeDiv;
    -->
    </script>
    <body>
    <div id="eMeng" style="border:1px solid #7788CC;visibility:hidden;position:absolute;top:0px;left:0px;height:150px;width:260px;">
      <div style="background-color:#7788FF;width:260px;height:20px;">
        <div style="cursor:hand;font-size:12px;font-weight:bold;text-align:right;" onclick="closeDiv()">×</div>
      </div>
      <div style="border:3px solid #BBCCFF;background-color:#D5E7FD;width:260px;height:130px;">
      <center>
        <span>HelloWorld</span>
      </center>
      </div>
    </div>
    <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    </body>
    </html>