<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>页面逐渐缩小</title>
<style>
.mydiv{
position:absolute;
left:0;
top:0;
layer-background-color:white;
background-color:white;
border:0.1px solid white
}
</style></head><body bgcolor="#000000">
<div id="div1" class="mydiv"></div>
<script type="text/javascript">
var speed=5; //变小的速度
var reference=document.body.clientWidth/document.body.clientHeight;
var temp=document.all.div1.style; //div样式
var leftclip,rightclip,topclip,bottomclip; //代表裁剪区域的上,下,左,右四个位置
leftclip=topclip=0;
rightclip=temp.width=document.body.clientWidth;
bottomclip=document.body.clientHeight;
function rectDiv(){
window.scrollTo(0,0); //窗体默认在0,0处,左上角
if(leftclip>document.body.clientWidth/2){
clearInterval(stopit); //停止缩小
}
temp.clip="rect( "+topclip+" "+rightclip+" "+bottomclip+" "+leftclip+")"; //裁剪一个区域
leftclip+=speed*reference; //动态设置裁剪区域的大小
topclip+=speed;
rightclip-=speed*reference;
bottomclip-=speed;
}
stopit=setInterval(rectDiv,1000);
</script>
</body>
</html>在temp.clip="rect( "+topclip+" "+rightclip+" "+bottomclip+" "+leftclip+")"; //裁剪一个区域IE8.0提示参数无效,希望大家帮忙解决下,非常感谢
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>页面逐渐缩小</title>
<style>
.mydiv{
position:absolute;
left:0;
top:0;
layer-background-color:white;
background-color:white;
border:0.1px solid white
}
</style></head><body bgcolor="#000000">
<div id="div1" class="mydiv"></div>
<script type="text/javascript">
var speed=5; //变小的速度
var reference=document.body.clientWidth/document.body.clientHeight;
var temp=document.all.div1.style; //div样式
var leftclip,rightclip,topclip,bottomclip; //代表裁剪区域的上,下,左,右四个位置
leftclip=topclip=0;
rightclip=temp.width=document.body.clientWidth;
bottomclip=document.body.clientHeight;
function rectDiv(){
window.scrollTo(0,0); //窗体默认在0,0处,左上角
if(leftclip>document.body.clientWidth/2){
clearInterval(stopit); //停止缩小
}
temp.clip="rect( "+topclip+" "+rightclip+" "+bottomclip+" "+leftclip+")"; //裁剪一个区域
leftclip+=speed*reference; //动态设置裁剪区域的大小
topclip+=speed;
rightclip-=speed*reference;
bottomclip-=speed;
}
stopit=setInterval(rectDiv,1000);
</script>
</body>
</html>在temp.clip="rect( "+topclip+" "+rightclip+" "+bottomclip+" "+leftclip+")"; //裁剪一个区域IE8.0提示参数无效,希望大家帮忙解决下,非常感谢
else temp.clip="rect( "+topclip+" "+rightclip+" "+bottomclip+" "+leftclip+")";
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>页面逐渐缩小 </title>
<style>
.mydiv{
position:absolute;
left:0;
top:0;
layer-background-color:white;
background-color:white;
border:0.1px solid white
}
</style> </head> <body bgcolor="#000000">
<div id="div1" class="mydiv"> </div>
<script type="text/javascript">
var speed=5; //变小的速度
var reference;
var temp; //div样式
var leftclip,rightclip,topclip,bottomclip; //代表裁剪区域的上,下,左,右四个位置 function rectDiv(){
window.scrollTo(0,0); //窗体默认在0,0处,左上角
if(leftclip > document.body.clientWidth/2){
clearInterval(stopit); //停止缩小
}
if(window.JSON) {
try{
temp.clip="rect("+topclip+"px,"+rightclip+"px,"+bottomclip+"px,"+leftclip+"px)";
}
catch(x){
alert("rect("+topclip+"px,"+rightclip+"px,"+bottomclip+"px,"+leftclip+"px)")
}
}
else temp.clip="rect( "+topclip+" "+rightclip+" "+bottomclip+" "+leftclip+")";
leftclip+=speed*reference; //动态设置裁剪区域的大小
topclip+=speed;
rightclip-=speed*reference;
bottomclip-=speed;
}
window.onload=function(){
reference=document.documentElement.clientWidth/document.documentElement.clientHeight;
temp=document.all.div1.style; //div样式
leftclip=topclip=0;
rightclip=temp.width=document.body.clientWidth;
bottomclip=document.body.clientHeight;
stopit=setInterval(rectDiv,1000);
}
</script>
</body>
</html>