A game similar to the mold side

Source: Internet
Author: User
Tip: You can modify some of the code before running

<ptml> <pead> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <title> similar to the model side of the game </title> </pead> <body> <script> function ShowMenu ( Bmenu) {Document.all.idFinder.style.display = (bmenu)? "None": "Block" Document.all.idMenu.style.display = (bmenu)? "Block": "None" Idml.classname = (bmenu)? "COn": "cOff" idrl.classname = (bmenu)? "COff": "COn" return false} </script> <style> A.con {text-decoration:none;font-weight:bolder} #article {fon T:12PT Verdana, Geneva, Arial, Sans-serif; Background:white; Color:black; padding:10pt 15pt 0 5pt} #article p.start {text-indent:0pt} #article P {margin-top:0pt;font-size:10pt;text-indent:12pt} #article #author {margin-bottom:5pt;text-indent:0pt;font-style:italic} #pageList P {padding-top:10pt} #article H3 { Font-weight:bold} #article DL, UL, OL {font-size:10pt} </style> <script> function addlist (URL,DESC) {if (NA vigator.appname== "Netscape") | | (parseint (navigator.appversion) >=4)) {var w=window.open ("", "_idhtml_list_", "top=0,left=0,width=475,height=150, History=no,menubar=no,status=no,resizable=no ") var d=w.document if (!w._init) {D.open () d.write (" <TITLE> Loading...</title><em>loading...</em> ") D.close () d.location.replace ("/assist/listing.asp?url= "+escape (URL) +" &desc= "+escape (DESC)) w.opener=self window.status=" Personal Assistant (Adding): "+ desc} else {wind Ow.status=w.addoption (URL,DESC) W.focus ()} else alert ("Your browser does not support the personal assistant.") return F Alse} </script> <style> #board {cursor:default} #board TD {width:25px; height:25px;} </style> <script> var size=10 var moves = 0 var off = size*2 var in = 0 var current = null function Doover () {if (event.srcelement.tagname== "TD") && (current!=event.srcelement)) {if ( Current!=null) Current.style.backgroundColor = current._background Event.srcelement._background = Event.srcElement.style.backgroundColor event.srcelement.style.b Ackgroundcolor = "Lightgrey" current = Event.srcelement}} function SetColor (EL) {if (el._ background== "") | | (El._background==null)) {El.style.backgroundColor = "yellow" El._background = "Yellow"} else {El.style.background Color = "" El._background = "}} function Countlights () {off = 0; On = 0 for (var x=0 x < size x + +) for (Var y=0 y < size; y++) {var p = Board.rows[x].cel Ls[y] if (p._background== "yellow") on++ else off + +} document . All.on.innerText = On if (off!=0) Document.all.off.innerText = off Else Document.all.off.inne Rtext = "You win!" Return (off==0)} function DoClick () {setcolor (current) var cellidx = Current.ceLlindex var rowidx = Current.parentElement.rowIndex if (rowidx>0) SetColor (board.rows[rowidx-1].cel LS[CELLIDX]) if (rowidx<size-1) SetColor (Board.rows[rowidx+1].cells[cellidx]) if (cellidx>0) SetColor (Board.rows[rowidx].cells[cellidx-1]) if (cellidx<size-1) SetColor (board.rows[rowidx].cells[ CELLIDX+1]) moves++ Document.all.moves.innerText = moves win = Countlights () if (win) {Bo Ard.onclick = NULL Board.onmouseover = null Current.style.background = "Yellow"}} functio n Buildboard () {var str = "<table id=board onselectstart=" return false "onclick=" DoClick () "Onmouseover=" Doover ( ) "Cellspacing=0 cellpadding=0 border=5>" for (var x=0 x < size; x + +) {str+= "<TR>" for (Var y=0 y < size; y++) {str+= "<TD> </TD>"} str+= "</TR>"} str+= "</TABLE>" Return str} function Newgame () {size = Document.all.gameSize.value if (size<3) size= 3 if (size>15) size=15 document.all.gameSize.value = Size Document.all.board.outerHTML = Buil Dboard () moves=0 Document.all.moves.innerText = Moves countlights ()} </script> <p al ign= "center" ><big><font color= "#0000FF" > Click on the box, you can fill in the following squares all yellow </font><strong>< Font color= "#FF0000" &GT;&LT;BIG&GT;&LT;BIG&GT;? </big></big></font></strong></big></p> <p align= "center" ><font Color = "#0000FF" > Quickly start your mind and see what skills and rules you have. </font></p> <table border= "1" width= "100%" > <tr> <td width= "50%" ><div align= "right "><table id=" score "border=" 0 "width=" 284 "> <tr> <td width=" "" > Mobile: </td> &LT;TD id= "Moves" width= ">0</td> <td width=" "> Lights Out: </td&Gt &LT;TD id= "Off" width= ">25</td> <td width=" "> Light:</td> <td id=" on "width=" 39 "& gt;0</td> </tr> </table> </div></td> <td width= "50%" ><div align= " Left "><table width=" 204 "> <tr> <td width=" si "> Size: </td> <td width=" 41 " ><input id= "Gamesize" type= "text" value= "ten" size= "2" ></td> <td width= "" "><input onclick= "Newgame ()" type= "button" value= "Start Game" ></td> </tr> </table> </div></td> & lt;/tr> </table> <p align= "center" ><script> document.write (Buildboard ()) </script></p > </body> </ptml>
Tip: You can modify some of the code before running

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.