<div class="codetitle"> <span><a style="CURSOR: pointer" data="83761" class="copybut" id="copybut83761" onclick="doCopy('code83761')"><u>复代码码</u></a></span> 代码如下:</div> <div class="codebody" id="code83761"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 전환//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <br><html xmlns="http://www.w3.org/1999/xhtml"> <br><머리> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br><title>侧边栏广告</title> <br><style type="text/css"> <br>#show { 너비:100px; 높이:80px; 배경:#0f0; 위치:고정; _위치:절대; 오른쪽:0px; top:0px;} <br></style> <br><script type="text/javascript"> <br>window.onscroll = window.onresize = window.onload = function(){ <br><br>var oDiv = document.getElementById("show"); <br>var sTop = document.documentElement.scrollTop || document.body.scrollTop; <br>var cHeight= document.documentElement.clientHeight || document.body.clientHeight; <br>var mid = (cHeight - oDiv.offsetHeight) / 2; <br>// oDiv.style.top = parsInt(sTop mid) "px"; //리리论上应该只设这句就可以居中吧 <br><br>//实际上的 各大浏览器只认识下这if判断 <br>if(navigator.appVersion.indexOf("MSIE 6 ") > -1){ <br>oDiv.style.top = parsInt(sTop mid) "px"; <br>}else{ <br>oDiv.style.top =mid "px"; <br>} <br>} <br> </div>