First, to generate non-repeating random numbers within n and put the generated random numbers into another Array, use the following method to complete:
function getRandomNumbers(count)
{
var numbers = new Array();
var original = new Array() ;
for (var i=0;i{
original[i] = i 1;
}
original.sort(function(){ return 0.5 - Math.random(); });
for (var i=0;i{
numbers[i] = original[i] - 1;
}
return numbers;
}
Then, in the background program, output the html script:
var sf = new Array();
sf[0]='
Server name | Server IP TD> | Opening time | Line category | Version introduction | Customer Service QQ | Detailed Introduction< /TD> |
';
sf[1]='
Server name TD> | Server IP | Opening Time< /TD> | Line Category | Version Introduction | Customer Service QQ | Details |
';
Use the previous method to generate random numbers and display the html script according to the random numbers.
var numbers = getRandomNumbers(sf.length);
for( i=0;i{
document.write(sf[numbers[i]]);
}