求一个随机显示文字的HTML页面.
答案:2 悬赏:80
解决时间 2021-03-12 21:30
- 提问者网友:烟刺痛了眼
- 2021-03-12 05:59
本人加做一个随机显示文字的HTML页嵌入我的一个页面里文字可以自己加,每次打开页面都是随机加载一段自己加进去的文字但不会做`哪个好新人帮忙做一个然后给个下载地址可以吗
最佳答案
- 二级知识专家网友:情窦初殇
- 2021-03-12 07:38
<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>试试看我已经做过测试
<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>试试看我已经做过测试
全部回答
- 1楼网友:有钳、任性
- 2021-03-12 07:59
太简单了。<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>
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯