js轮播

<script language=javascript>
//js自动手动轮播
var current;//设置当前帧的变量容器
current=0;
var timer=2000;// 
function showtext(id){
 current=id;
 for(i=1;i<=3;i++){
  document.getElementById("slidetext"+i).style.display="none";
  document.getElementById("span"+i).style.color="#000000";
 }
 document.getElementById("slidetext"+id).style.display="";
 document.getElementById("span"+id).style.color="#ff0000";
 }
 function goNext(){//自动切换
  current=current+1;
  if(current<=3){
   //alert(current);
   showtext(current);
  }
  else{
   current=0;
   //showtext(current);
  }
}
var h=setInterval("goNext()",timer)//开始自动切换    
</script>    
<div id="slidetext1">
slidetext1
</div>
<div id="slidetext2" style="display:none">
slidetext2
</div>
<div id="slidetext3" style="display:none">
slidetext3
</div>

<span id="span1" onmouseover="showtext(1)" style="color:#FF0000">1</span>
<span id="span2" onmouseover="showtext(2)">2</span>
<span id="span3" onmouseover="showtext(3)">3</span>

    A+
发布日期:2009年10月23日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: