Javascript - javascript中的rect()问题!!
<head><style>
<!--
.intro{
position:absolute;
left:0;
top:0;
layer-background-color:#33cc00;
background-color:#33cc00;
border:0.1px solid black
}
-->
</style>
</head>
<body>
<div id="i1" class="intro"></div><div id="i2" class="intro"></div>
<SCRIPT Language="JavaScript">
var speed=20
var temp=new Array()
var temp2=new Array()
if (document.layers){
for (i=1;i<=2;i++){
temp=eval("document.i"+i+".clip")
temp2=eval("document.i"+i)
temp.width=window.innerWidth
temp.height=window.innerHeight/2
temp2.top=(i-1)*temp.height
}
}
else if (document.all){
var clipbottom=document.body.offsetHeight/2,cliptop=0
for (i=1;i<=2;i++){
temp=eval("document.all.i"+i+".style")
temp.width=document.body.clientWidth
temp.height=document.body.offsetHeight/2
temp.top=(i-1)*parseInt(temp.height)
}
}
function openit(){
window.scrollTo(0,0)
if (document.layers){
temp[1].bottom-=speed
temp[2].top+=speed
if (temp[1].bottom<=0)
clearInterval(stopit)
}
else if (document.all){
clipbottom-=speed
cliptop+=speed
temp[1].clip="rect(0 auto "+clipbottom+" 0)"
temp[2].clip="rect("+cliptop+" auto auto )"
if (clipbottom<=0)
clearInterval(stopit)
}
}
function gogo(){
stopit=setInterval("openit()",1000)
}
gogo()
</SCRIPT>
</body>
这段代码是用javascript实现层从上下载入的特效,但是本人对代码中的rect(0 auto "+clipbottom+" 0)和
rect("+cliptop+" auto auto )这两句话不能理解。rect()的参数一回儿四个,一会儿三个。搞不懂请高手帮忙解析!!