<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <HEAD> <TITLE>随滚动条移动的层 - webjx.com</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html" charset="gb2312"> <META NAME="Author" CONTENT="flasher"> <META NAME="homepage" CONTENT="www.webjx.com"> </HEAD> <style> <!-- .div{ position: absolute; border: 2px solid red; line-height:90px; font-size:12px; z-index:1000; } --> </style> <BODY> <div id="Javascript.Div5" class="div" style="width: 240px; height:120px" align="center">一直在右下,不停的随着滚动条滚动!</div> <SCRIPT LANGUAGE="JavaScript"> function sc5(){ document.getElementById("Javascript.Div5").style.top =(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("Javascript.Div5").offsetHeight)+"px"; document.getElementById("Javascript.Div5").style.left =(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.Div5").offsetWidth)+"px"; } </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> <!-- function scall(){ sc5(); } window.onscroll=scall; window.onresize=scall; window.onload=scall; //--> </SCRIPT> <div style="position: absolute; top: 0px; left: 0px; width: 940px; height: 1000px;"></div> </BODY> </HTML>
详细解决方案
div 定位至右上角
热度:28 发布时间:2012-11-05 09:35:12.0
相关解决方案