渡 //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<头>
>
侧边栏广告
#show { 宽度:100px;高度:80px;背景:#0f0;位置:固定; _位置:绝对;右:0px;顶部:0px;}
window.onscroll = window.onresize = window.onload = function(){
var oDiv = document.getElementById("show");
var sTop = document.documentElement.scrollTop ||文档.body.scrollTop;
var cHeight= document.documentElement.clientHeight ||文档.body.clientHeight;
var mid = (cHeight - oDiv.offsetHeight) / 2;
// oDiv.style.top = parseInt(sTop mid) "px"; // 理论上应该只假设这句话就可以居中吧
// 实际上的四大浏览器只认识下面这个if判断
if(navigator.appVersion.indexOf("MSIE 6") > -1){
oDiv.style.top = parseInt(sTop mid) "px";
}else{
oDiv.style.top =mid "px";
}
}