浮动广告特效-----上下左右中(全)

浮动广告特效-----上下左右中(全)

 

 

 

 

<html>
<head>
<title>网页特效-CSS特效-始终在页面固定位置的层</title>
<meta http-equiv="content-Type" content="text/html;charset=gb2312">
<!--把下面代码加到<head>与</head>之间-->
<style>
<!--
.div{
 position: absolute;
 border: 2px solid red;
 background-color: #EFEFEF;
 line-height:90px;
 font-size:12px;
 z-index:1000;
}
-->
</style>
</head>
<body>
<!--把下面代码加到<body>与</body>之间-->
<div id="Javascript.Div1" class="div" style="width: 240; height:90" 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 id="Javascript.Div2" class="div" style="width: 240; height:90;" align="center">左上...</div>
<SCRIPT LANGUAGE="JavaScript">
function sc2(){
 document.getElementById("Javascript.Div2").style.top=document.body.scrollTop
 document.getElementById("Javascript.Div2").style.left=document.body.scrollLeft;
}
</SCRIPT>
<div id="Javascript.Div3" class="div" style="width: 240; height:90;" 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 id="Javascript.Div4" class="div" style="width: 240; height:90;" 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 id="Javascript.Div5" class="div" style="width: 240; height:90;" 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="position: absolute; top: 0; left: 0; width: 10000; height: 4000;"></div>
</body>
</html>

 

 

 

 

欢迎转载--------------------------不错的页面特效哦

你可能感兴趣的:(JavaScript,html,css)