[IT科技] 求一个随机显示文字的HTML页面.

发表于 @ 2009-7-25 17:19:03

本人加做一个随机显示文字的HTML页嵌入我的一个页面里

文字可以自己加,每次打开页面都是随机加载一段自己加进去的文字

但不会做`哪个好新人帮忙做一个然后给个下载地址可以吗

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>阿里西西网页特效演示,文本随机显示</title>
</head>

<body>
刷新看看

<script language="JavaScript">
<!-- Hide
var a = Math.random() + ""
var rand1 = a.charAt(5)
quotes = new Array
<!-- 修改下面的文字为你需要的文字-->
quotes[1] = '文本内容1'
quotes[2] = '文本内容2'
quotes[3] = '文本内容3'
quotes[4] = '文本内容4'
quotes[5] = '文本内容5'
quotes[6] = '文本内容6'
quotes[7] = '文本内容7'
quotes[8] = '文本内容8'
quotes[9] = '文本内容9'
quotes[0] = '文本内容10'
var quote = quotes[rand1]
//-->
</script>
<script language="JavaScript">
<!-- Hide
document.write(quote)
// -->
</script>

</body>

</html>

试试看

我已经做过测试

太简单了。

<script type="text/javascript">
  <!--
        var len=3;//提示文字数,为了例子简单,所以只设3段文字
 var rnd=Math.floor(Math.random()*len);
 var txt=new Array(len);
     txt[0]="早起的鸟儿有虫吃";
     txt[1]="晚起的鸟儿没虫吃";
     txt[2]="早起的虫子被鸟吃";
   document.write(txt[rnd]);
  //-->
  </script>

 



from:http://wenwen.soso.com/z/q145462242.htm


Copyright © 2009 老紫竹
网站地图 | 最新文章 | 未读文章 | 24小时内热点文章 |津ICP备09000085号