li.的博客
li.的首页 > li.的博客 > 浏览文章

始终显示在页面固定位置的层效果

分类:javascript  人气:1319  评论:1  时间:2011-03-03 14:16

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0037)http://www.pczhi.com/texiao/3639.html -->
<HTML><HEAD><TITLE>始终在页面固定位置的层_网页特效演示页_阿里西西整理收集。</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">

<STYLE>.div {
 BORDER-RIGHT: #0000ff 2px solid; BORDER-TOP: #0000ff 2px solid; FONT-SIZE: 12px; Z-INDEX: 1000; BORDER-LEFT: #0000ff 2px solid; LINE-HEIGHT: 90px; BORDER-BOTTOM: #0000ff 2px solid; POSITION: absolute; BACKGROUND-COLOR: #efefef
}
</STYLE>

<META content="MSHTML 6.00.2900.3395" name=GENERATOR></HEAD>
<BODY leftMargin=0 topMargin=0 marginheight="0" marginwidth="0"><!--网页特效代码开始-->
<DIV class=div id=Javascript.Div1 style="WIDTH: 240px; HEIGHT: 90px"
align=center>正中...</DIV>
<SCRIPT language=JavaScript>
function sc1(){
 document.getElementById("Javascript.Div1").style.top=document.body.scrollTop+(document.body.clientHeight-document.getElementById("Javascript.Div1").offsetHeight)/2
 document.getElementById("Javascript.Div1").style.left=document.body.scrollLeft+(document.body.clientWidth-document.getElementById("Javascript.Div1").offsetWidth)/2;
}
</SCRIPT>

<DIV class=div id=Javascript.Div2 style="WIDTH: 240px; HEIGHT: 90px"
align=center>左上...</DIV>
<SCRIPT language=JavaScript>
function sc2(){
 document.getElementById("Javascript.Div2").style.top=document.body.scrollTop;//document.documentElement.scrollTop标准网页写法
 document.getElementById("Javascript.Div2").style.left=document.body.scrollLeft;
}
</SCRIPT>

<DIV class=div id=Javascript.Div3 style="WIDTH: 240px; HEIGHT: 90px"
align=center>左下...</DIV>
<SCRIPT language=JavaScript>
function sc3(){
 document.getElementById("Javascript.Div3").style.top=document.body.scrollTop+document.body.clientHeight-document.getElementById("Javascript.Div3").offsetHeight;
 document.getElementById("Javascript.Div3").style.left=document.body.scrollLeft;
}
</SCRIPT>

<DIV class=div id=Javascript.Div4 style="WIDTH: 240px; HEIGHT: 90px"
align=center>右上...</DIV>
<SCRIPT language=JavaScript>
function sc4(){
 document.getElementById("Javascript.Div4").style.top=document.body.scrollTop;
 document.getElementById("Javascript.Div4").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("Javascript.Div4").offsetWidth;
}
</SCRIPT>

<DIV class=div id=Javascript.Div5 style="WIDTH: 240px; HEIGHT: 90px"
align=center>右下...</DIV>
<SCRIPT language=JavaScript>
function sc5(){
 document.getElementById("Javascript.Div5").style.top=document.body.scrollTop+document.body.clientHeight-document.getElementById("Javascript.Div5").offsetHeight;
 document.getElementById("Javascript.Div5").style.left=document.body.scrollLeft+document.body.clientWidth-document.getElementById("Javascript.Div5").offsetWidth;;
}
</SCRIPT>

<SCRIPT language=JavaScript>
<!--
function scall(){
 sc1();sc2();sc3();sc4();sc5();
}
window.onscroll=scall;
window.onresize=scall;
window.onload=scall;
//-->
</SCRIPT>

<DIV
style="LEFT: 0px; WIDTH: 10000px; POSITION: absolute; TOP: 0px; HEIGHT: 4000px"></DIV><!--网页特效代码结束--></BODY></HTML>

标签(Tag):固定层 javascript
评论(1)
li.
li.2011年3月4日
不太兼容
我来评论
(800字以内)