Chinaunix首页 | 论坛 | 博客
  • 博客访问: 27674
  • 博文数量: 23
  • 博客积分: 920
  • 博客等级: 准尉
  • 技术积分: 240
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-10 17:29
文章分类

全部博文(23)

文章存档

2011年(2)

2010年(21)

我的朋友
最近访客

分类: Java

2010-11-11 11:23:39

<!--计时器1-->
<script>
function count()
{
    setTimeout("alert('三秒到了')",3000);
}
</script>
<input type="button" value="开始计时" onclick="count()" />
<br />
<!--计时器2-->
<script>
function show()
{
    document.all['news'].style.display="";
    setTimeout("hide()",500);
}
function hide()
{
    document.all['news'].style.display="none";
    setTimeout("show()",500);
    //clearTimeout("news");

}
</script>
<body onload="show()">
最新消息: <font id="news" style="display:none">十面埋伏.....</font>
</body>
<br />
<!--计时器3-->
<script>
var sec=0;
timeID=setInterval("count()",1000);
function count()
{
    num.innerHTML=sec++;
}
</script>
停留时间:<font id="num" face="impact">0</font>秒钟
 &nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="停止" onclick="clearInterval(timeID)" />
 <br />
 <!--计时器4-->
<script>
var str = "这是一个在线拍卖的网站,请尽情血拼吧!";
var seq = 0;
function scroll() {
    msg = str.substring(0, seq+1);
    banner.innerHTML = msg;
    seq++;
    if (seq >= str.length) seq = 0;
}
</Script>
<body onLoad="setInterval('scroll()',500)">
<font id="banner"></font>
</body>


阅读(329) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~