<% @ Page Language = " C# " AutoEventWireup = " true " CodeFile = " Default.aspx.cs " Inherits = " _Default " %> // Colder:LinQiFo, <! DOCTYPE html PUBLIC " -//W3C//DTD XHTML 1.0 Transitional//EN " " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd " > < html xmlns = " http://www.w3.org/1999/xhtml " > < head > < title > JS测试 </ title > < script type = " text/javascript " > window.onload = initAll; var arr = new Array( 37 ); function initAll() ... { if(document.getElementById) ...{ //document.getElementById ("reLoad").onclick =newGG; newNum(); } else ...{ alert("'Sorry,your browser doesn't support this script!"); } } function newNum() ... { for(var i=0;i<8;i++) ...{ setSquare(i); } } function setSquare(thisSquare) ... { var currSquare="square"+thisSquare; var newNum1; do ...{ newNum1=getNewNum()+1; } while(arr[newNum1]); arr[newNum1]=true; document.getElementById (currSquare).innerHTML =newNum1; } function getNewNum() ... { return Math.floor (Math.random ()*36); } function newGG() ... { for(var j=0;j<arr.length ;j++) ...{ arr[j]=false; } newNum(); return false; } </ script > </ head > < body > < form action = " # " > < input type = " button " id = " reLoad " value = " 再选 " onclick = " newGG() " /></ form > < form id = " form1 " action = " # " > < div > < table style = " width: 428px; height: 49px " border = " 1 " > < tr > < td style = " width: 52px; height: 34px " > 1 </ td > < td style = " height: 34px " > 2 </ td > < td style = " width: 51px; height: 34px " > 3 </ td > < td style = " height: 34px " > 4 </ td > < td style = " height: 34px " > 5 </ td > < td style = " height: 34px " > 6 </ td > < td style = " width: 51px; height: 34px " > 7 </ td > < td style = " height: 34px " > 特别号 </ td > </ tr > < tr > < td id = " square0 " style = " width: 52px; height: 168px " > </ td > < td id = " square1 " style = " height: 168px " > </ td > < td id = " square2 " style = " width: 51px; height: 168px " > </ td > < td id = " square3 " style = " height: 168px " > </ td > < td id = " square4 " style = " height: 168px " > </ td > < td id = " square5 " style = " height: 168px " > </ td > < td id = " square6 " style = " width: 51px; height: 168px " > </ td > < td id = " square7 " style = " height: 168px " > </ td > </ tr > </ table > </ div > </ form > </ body > </ html >