该文章转载自网络大本营:http://www.xrss.cn/Info/14120.Html
var w = jQuery(myAlert).innerWidth(),
h = jQuery(myAlert).innerHeight();
jQuery(myAlert).css({
'position':'fixed',
'top':'50%',
'left':'50%',
'margin-top':-(h/2),
'margin-left':-(w/2)
}).show();
myAlert是要弹出的div,fixed表示不随滚动条滚动,w和h算出来的是div的高和宽