ภาษาไทย
<!DOCTYPE html สาธารณะ "-//W3C//DTD XHTML 1.0 การเปลี่ยนผ่าน//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http ://www.w3.org/1999/xhtml"> <HEAD> <TITLE>随滚动条移动的层 - downcodes.com</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/ html" charset="gb2312"> <META NAME="ผู้เขียน" CONTENT="flasher"> <META NAME="homepage" CONTENT="www.downcodes.com"> </HEAD> <style> <!-- div { ตำแหน่ง: สัมบูรณ์; เส้นขอบ: สีแดงทึบ 2px; สีพื้นหลัง: #EFEFEF; ความสูงของบรรทัด:90px; ขนาดตัวอักษร:12px; ดัชนี z:1000; } --> </style> <BODY> <div id="Javascript.Div1" class="div" style="width: 240px; height:90px" align="center">正中...</div> <SCRIPT LANGUAGE="JavaScript"> function sc1(){ document.getElementById("Javascript.Div1").style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-document.getElementById("Javascript.Div1" ).offsetHeight)/2)+"px"; document.getElementById("Javascript.Div1").style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-document.getElementById("Javascript.Div1").offsetWidth)/2)+"px"; } </SCRIPT> <div id="Javascript.Div2" class="div" style="width: 240px; height:90px" align="center">左上...</div> <SCRIPT LANGUAGE="JavaScript "> ฟังก์ชั่น sc2(){ document.getElementById("Javascript.Div2").style.top=(document.documentElement.scrollTop)+"px"; document.getElementById("Javascript.Div2").style.left=(document.documentElement.scrollLeft)+"px"; } </SCRIPT> <div id="Javascript.Div3" class="div" style="width: 240px; height:90px" align="center">左下...</div> <SCRIPT LANGUAGE="JavaScript "> ฟังก์ชั่น sc3(){ document.getElementById("Javascript.Div3").style.top=(document.documentElement.scrollTop+document.documentElement.clientHeight-document.getElementById("Javascript.Div3").offsetHeight)+" พิกเซล"; document.getElementById("Javascript.Div3").style.left=(document.documentElement.scrollLeft)+"px"; } </SCRIPT> <div id="Javascript.Div4" class="div" style="width: 240px; height:90px" align="center">右上...</div> <SCRIPT LANGUAGE="JavaScript "> ฟังก์ชั่น sc4(){ document.getElementById("Javascript.Div4").style.top=(document.documentElement.scrollTop)+"px"; document.getElementById("Javascript.Div4").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.Div4").offsetWidth)+"px"; } </SCRIPT> <div id="Javascript.Div5" class="div" style="width: 240px; height:90px" 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)+ "พิกเซล"; document.getElementById("Javascript.Div5").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("Javascript.Div5").offsetWidth)+"px"; } </SCRIPT> <SCRIPT LANGUAGE="JavaScript"> <!-- ฟังก์ชั่น scall(){ sc1();sc2();sc3();sc4();sc5(); } window.onscroll=scall; window.onresize=scall; window.onload=scall; //--> </SCRIPT> <div style="position: Absolute; top: 0px; left: 0px; width: 10000px; height: 4000px;"></div> </BODY> </HTML>