求文字随机显示HTML代码(要求支持10条以上文字显示的)
求文字随机显示HTML代码(要求支持10条以上文字显示的)我找到能显示10条文字的代码,但是少啊~~~我有很多要显示的内容。。。谢谢高手啦!~!<scriptlangua...
求文字随机显示HTML代码(要求支持10条以上文字显示的)
我找到能显示10条文字的代码,但是少啊~~~我有很多要显示的内容。。。谢谢高手啦!~!
<script language="JavaScript">
<!-- Hide
var a = Math.random() + ""
var rand1 = a.charAt(5)
quotes = new Array
quotes[1] = '123123'
quotes[2] = '12322222'
quotes[3] = '655555555555'
quotes[4] = '666666666'
quotes[5] = '7777777'
quotes[6] = '8888'
quotes[7] = '999'
quotes[8] = '0000'
quotes[9] = '222'
quotes[0] = '111'
var quote = quotes[rand1]
//-->
</script>
<script language="JavaScript">
<!-- Hide
document.write(quote)
// -->
</script>
纠正:Math.floor(Math.random()*8+1)); //1~8之间的,就是1-8 (而不是显示0-9的)
正确代码:(随机显示从0到X的文字)
X 是你想要的条数
<script language="JavaScript">
<!-- Hide
var rand1 = Math.floor(Math.random()*X+0);
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] = '00000000000'
quotes[10] = '10'
quotes[11] = '11'
...
quotes[X] = 'xxx'
var quote = quotes[rand1]
//-->
</script>
</script>
<script language="JavaScript">
<!-- Hide
document.write(quote)
// -->
</script> 展开
我找到能显示10条文字的代码,但是少啊~~~我有很多要显示的内容。。。谢谢高手啦!~!
<script language="JavaScript">
<!-- Hide
var a = Math.random() + ""
var rand1 = a.charAt(5)
quotes = new Array
quotes[1] = '123123'
quotes[2] = '12322222'
quotes[3] = '655555555555'
quotes[4] = '666666666'
quotes[5] = '7777777'
quotes[6] = '8888'
quotes[7] = '999'
quotes[8] = '0000'
quotes[9] = '222'
quotes[0] = '111'
var quote = quotes[rand1]
//-->
</script>
<script language="JavaScript">
<!-- Hide
document.write(quote)
// -->
</script>
纠正:Math.floor(Math.random()*8+1)); //1~8之间的,就是1-8 (而不是显示0-9的)
正确代码:(随机显示从0到X的文字)
X 是你想要的条数
<script language="JavaScript">
<!-- Hide
var rand1 = Math.floor(Math.random()*X+0);
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] = '00000000000'
quotes[10] = '10'
quotes[11] = '11'
...
quotes[X] = 'xxx'
var quote = quotes[rand1]
//-->
</script>
</script>
<script language="JavaScript">
<!-- Hide
document.write(quote)
// -->
</script> 展开
1个回答
展开全部
Math.floor(Math.random()*8+1)); //0~9之间的,就是1-8
x 是你想要的条数
<script language="JavaScript">
<!-- Hide
var rand1 = Math.floor(Math.random()*x+1));
quotes = new Array
quotes[1] = '123123'
quotes[2] = '12322222'
quotes[3] = '655555555555'
quotes[4] = '666666666'
quotes[5] = '7777777'
quotes[6] = '8888'
quotes[7] = '999'
quotes[8] = '0000'
quotes[9] = '222'
quotes[0] = '111'
....
quotes[x] = '11145345'
var quote = quotes[rand1]
//-->
</script>
应该可以,没尝试~~~
x 是你想要的条数
<script language="JavaScript">
<!-- Hide
var rand1 = Math.floor(Math.random()*x+1));
quotes = new Array
quotes[1] = '123123'
quotes[2] = '12322222'
quotes[3] = '655555555555'
quotes[4] = '666666666'
quotes[5] = '7777777'
quotes[6] = '8888'
quotes[7] = '999'
quotes[8] = '0000'
quotes[9] = '222'
quotes[0] = '111'
....
quotes[x] = '11145345'
var quote = quotes[rand1]
//-->
</script>
应该可以,没尝试~~~
博思aippt
2024-07-20 广告
2024-07-20 广告
博思AIPPT是基于ai制作PPT的智能在线工具,它提供了4种AI制作PPT的方式,包括AI生成大纲、AI直接生成PPT、文本生成PPT、AI提炼word文档生成PPT,一站式集成多种AI生成PPT的方式,可满足办公用户的不同需求和使用场景...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询