rollarea.js及其用法示例
发表于:2007-06-30来源:作者:点击数:
标签:
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=cl
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>
原文转自:http://www.ltesting.net