网页弹出窗口在主网页的正中间,加入右侧广告

$("body").append("<div id=FloatDIV style='position: absolute;top: 0px;  z-index:1000'> <div><img id=message_dialog src=/img/people_yy.jpg /></div></div>")
   var MarginLeft = 10;   //浮动层离浏览器右侧的距离
   var MarginTop = 190;   //浮动层离浏览器顶部的距离
   var Width = 232;            //浮动层宽度
   var Heigth= 145;           //浮动层高度
  
  //设置浮动层宽、高
   function Set()
   {
      document.getElementById("FloatDIV").style.width = Width + 'px';
      document.getElementById("FloatDIV").style.height = Heigth + 'px';
   }
  
  //实时设置浮动层的位置
   function Move()
   {
        var b_top = window.pageYOffset
                || document.documentElement.scrollTop
                || document.body.scrollTop
                || 0;
        var b_width= document.body.clientWidth;
      document.getElementById("FloatDIV").style.top = b_top + MarginTop + 'px';
      document.getElementById("FloatDIV").style.left = b_width - Width - MarginLeft + 'px';
      setTimeout("Move();",100);
   }
  
   Set();
   Move();

会在右侧固定位置停靠

$(document).ready(function(){
	 $("#message_dialog").bind("click",function(){
	     $("#FloatDIV").hide();
	    openWin('chat.asp',800,500)
	 });
});

function openWin(u, w, h) { 
            var l = (screen.width - w) / 2; 
            var t = (screen.height - h) / 2; 
            var s = 'width=' + w + ', height=' + h + ', top=' + t + ', left=' + l; 
            s += ', toolbar=no, scrollbars=no, menubar=no, location=no, resizable=no'; 
            open(u, 'oWin', s); 
      } 
弹出新网页的位置与大小



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lyflcear

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值