<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 Transitional//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;高さ:80ピクセル;背景:#0f0;位置:固定; _位置:絶対;右:0ピクセル; 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>varmid = (cHeight - oDiv.offsetHeight) / 2; <br>// oDiv.style.top = parseInt(sTop Mid) "px"; //理论上应该只设这句就居中吧 <br><br>//实际上の各大赏览器只认识下面这判断<br>if(navigator.appVersion.indexOf("MSIE 6") > -1){ <br>oDiv.style.top = parseInt(sTop Mid) "px"; <br>}else{ <br>oDiv.style.top =mid "px"; <br>} <br>} <br> </div>