<div class="htmlarea"> <textarea id="runcode39106"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>无标题文档</title> <style> #left{ width:200px;height:450px; position:absolute; left:0px; background:red; border:1px #000 solid} #right{width:200px;height:450px; position:absolute; right:0px; background:blue; border:1px #000 solid} #x,#y{ width:10px; height:10px;position:absolute;right:0px; top:0px;} </style> <script> window.onload=window.onscroll=function() { var oLeft = document.getElementById("left"); var oRight = document.getElementById("right"); var scrollY=document.documentElement.scrollTop||document.body.scrollTop; var clientH = document.documentElement.clientHeight; var oCloseX =document.getElementById("x") var oCloseY =document.getElementById("y") oLeft.style.top=(clientH-oLeft.offsetHeight)/2+scrollY+"px"; oRight.style.top=(clientH-oRight.offsetHeight)/2+scrollY+"px"; oCloseX.onclick=function() { this.parentNode.parentNode.removeChild(this.parentNode); } } </script> <div id="left"> <div id="x">x</div> </div> <div id="right"> <div id="y">x</div> </div> </textarea><br><input onclick="runEx('runcode39106')" type="button" value="运行代码"> <input onclick="doCopy('runcode39106')" type="button" value="复制代码"> <input onclick="doSave(runcode39106)" type="button" value="保存代码">[Ctrl+A 全选 注:<a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">如需引入外部Js需刷新才能执行</a>]</div>