var clip_t,clip_b,clip_r,clip_l,layer_t,layer_top,clip_top,clip_bottom,clip_left,clip_right;
function rollArea(top,right,bottom,left,string){
var HTMLStr;
layer_t=layer_top=bottom;
clip_t=clip_top=top-bottom;
clip_b=clip_bottom=0;
clip_l=clip_left=0;
clip_r=clip_right=right-left;
HTMLStr="<div style=position:absolute;background-color:blue;filter:alpha(opacity=20)"+
";top:"+top+"px;left:"+left+
"px;width:"+(right-left)+"px;height:"+(bottom-top)+" ></div>";
HTMLStr+="<div id=layer style=visibility:hidden;position:absolute";
HTMLStr+=";top:"+bottom+"px;left:"+left+"px;width:"+(right-left)+
"px;rect("+clip_t+"px "+clip_r+"px "+clip_b+"px "+clip_l+"px) >";
HTMLStr+="</div>";
document.write(HTMLStr);
//layer.innerText=HTMLStr;
layer.innerHTML=string;
layer.style.visibility="visible";
//;zIndex:-1
//layer.style.zIndex=1;
}
function rollDida(){
clip_t++;
clip_b++;
layer_t--;
if(clip_t>parseInt(layer.clientHeight)){
clip_t=clip_top;
clip_b=clip_bottom;
layer_t=layer_top;
}
layer.style.clip="rect("+clip_t+"px "+clip_r+"px "+clip_b+"px "+clip_l+"px)";
layer.style.top=layer_t+"px";
}
用法:
<script language="javascript" src=../../"/hangzhou/include/rollarea.js"></script>
<script language="javascript">
<!--
rollArea(0,570,40,220,"你的文本");
window.setInterval("rollDida()",100);
//-->
</script>