刷新时的JavaScript随机文本:无法添加超过10个随机引号

时间:2015-09-17 11:05:58

标签: javascript text random refresh rotator

我在刷新时使用这个javascript随机文本旋转器:

// JavaScript Document

var theText = new Array() // do not change this

theText[0] = 'xxx';
theText[1] = 'xxx';
theText[2] = 'xxx';
theText[3] = 'xxx';
theText[4] = 'xxx';
theText[5] = 'xxx';
theText[6] = 'xxx';
theText[7] = 'xxx';
theText[8] = 'xxx';
theText[9] = 'xxx';
theText[50] = 'xxx';
theText[51] = 'xxx';
theText[52] = 'xxx';
theText[53] = 'xxx';
theText[54] = 'xxx';
theText[55] = 'xxx';
theText[56] = 'xxx';
theText[57] = 'xxx';
theText[58] = 'xxx';
theText[59] = 'xxx';
theText[60] = 'xxx';
theText[61] = 'xxx';
theText[62] = 'xxx';
theText[63] = 'xxx';
theText[64] = 'xxx';
theText[65] = 'xxx';
theText[66] = 'xxx';
theText[67] = 'xxx';
theText[68] = 'xxx';
theText[69] = 'xxx';
theText[70] = 'xxx';
theText[71] = 'xxx';
theText[72] = 'xxx';
theText[73] = 'xxx';
theText[74] = 'xxx';
theText[75] = 'xxx';
theText[76] = 'xxx';
theText[77] = 'xxx';
theText[78] = 'xxx';
theText[79] = 'xxx';
theText[80] = 'xxx';
theText[81] = 'xxx';
theText[82] = 'xxx';
theText[83] = 'xxx';
theText[84] = 'xxx';
theText[85] = 'xxx';
theText[86] = 'xxx';
theText[87] = 'xxx';
theText[88] = 'xxx';
theText[89] = 'xxx';
theText[90] = 'xxx';
theText[91] = 'xxx';
theText[92] = 'xxx';
theText[93] = 'xxx';
theText[94] = 'xxx';
theText[95] = 'xxx';
theText[96] = 'xxx';
theText[97] = 'xxx';
theText[98] = 'xxx';
theText[99] = 'xxx';

// do not edit anything below this line

var j = 0
var p = theText.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Array()
   preBuffer[i].src = theText[i]
}
var whichText = Math.round(Math.random()*(p-1));
function showText(){
//This a wrapper for the text array it can be changed if need
document.write('<p class="thetext'+theText[whichText]+'</p>');
}




//and then the call function...
showText();

(并且没有正确编号将无法正常工作)

您不能添加超过10种不同的引号,因为它根本不会使用它们。 如何让此脚本使用超过10个引号?

也许0-99引用?

0 个答案:

没有答案