First, we need to generate random numbers that do not repeat within n and put the generated random numbers into another Array, and use the following method to complete it:
function getRandomNumbers(count)
{
var numbers = new Array();
var original = new Array();
for (var i=0;i<count;i++)
{
original[i] = i+1;
}
(function(){ return 0.5 - (); });
for (var i=0;i<count;i++)
{
numbers[i] = original[i] - 1;
}
return numbers;
}
Then, in the background program, output the html script:
var sf = new Array();
sf[0]='<tr><TD width=120><a href=# target=_blank>Server name</a></TD><TD width=110><a href=http://sc. target=_blank>Server IP</a></TD><TD width=160>Opening time</TD><TD align=center width=95>Line category</TD><TD> Version introduction</TD><TD width=105>Customer service QQ</TD><TD align=center width=55><a href=# target=_blank><font color=#000000>Detailed introduction</font></a></TD></tr>';
sf[1]='<tr><TD width=120><a href=# target=_blank>Server name</a></TD><TD width=110><a href=http://s. target=_blank>Server IP</a></TD><TD width=160> Zone opening time</TD><TD align=center width=95>Line category</TD><TD> Version introduction</TD><TD width=105>Customer service QQ</TD><TD align=center width=55><a href=# target=_blank><font color=#000000>Detailed introduction</font></a></TD></tr>';
Then use the previous method to generate a random number and display the html script according to the random number.
var numbers = getRandomNumbers();
for( i=0;i<;i++ )
{
(sf[numbers[i]]);
}
Copy the codeThe code is as follows:
function getRandomNumbers(count)
{
var numbers = new Array();
var original = new Array();
for (var i=0;i<count;i++)
{
original[i] = i+1;
}
(function(){ return 0.5 - (); });
for (var i=0;i<count;i++)
{
numbers[i] = original[i] - 1;
}
return numbers;
}
Then, in the background program, output the html script:
Copy the codeThe code is as follows:
var sf = new Array();
sf[0]='<tr><TD width=120><a href=# target=_blank>Server name</a></TD><TD width=110><a href=http://sc. target=_blank>Server IP</a></TD><TD width=160>Opening time</TD><TD align=center width=95>Line category</TD><TD> Version introduction</TD><TD width=105>Customer service QQ</TD><TD align=center width=55><a href=# target=_blank><font color=#000000>Detailed introduction</font></a></TD></tr>';
sf[1]='<tr><TD width=120><a href=# target=_blank>Server name</a></TD><TD width=110><a href=http://s. target=_blank>Server IP</a></TD><TD width=160> Zone opening time</TD><TD align=center width=95>Line category</TD><TD> Version introduction</TD><TD width=105>Customer service QQ</TD><TD align=center width=55><a href=# target=_blank><font color=#000000>Detailed introduction</font></a></TD></tr>';
Then use the previous method to generate a random number and display the html script according to the random number.
Copy the codeThe code is as follows:
var numbers = getRandomNumbers();
for( i=0;i<;i++ )
{
(sf[numbers[i]]);
}