日期:2014-05-16 浏览次数:20502 次
<html> <head> <title></title> </head> <body> <div style="height:960px;background:#330000;">teatteat</div> <div id="t" style="height:24px;background:#000000;color:#ffffff;text-align:center;">teatteat</div> <div style="height:960px;background:#333333;">teatteat</div> <script type="text/javascript"> document.body.onscroll=function(){ if(document.body.scrollTop>=document.getElementById("t").offsetTop){ document.getElementById("t").style.position="absolute"; document.getElementById("t").style.top=document.body.scrollTop; } else { document.getElementById("t").style.position="static"; document.getElementById("t").style.top=document.body.scrollTop; } } </script> </body> </html>