$("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);
}
弹出新网页的位置与大小