谁可以将下面的方格全部填成黄色
<DIV class=htmlcode><P><html><head><br><meta Name="description"<br>Content="A DHTML Puzzle. Try to turn all the lights back on. For Internet Explorer 4.0."><br><meta Name="keywords"<br>Content="developers, microsoft, web, internet, explorer, 4.0, dynamic, html, document, object, model, jscripts, javascripts, VBScripts, programming, games"><br><link REL="stylesheet" TYPE="text/css" HREF="_res/css/theme.css"><br><script><br>function ShowMenu(bMenu) {<br>document.all.idFinder.style.display = (bMenu) ? "none" : "block" <br>document.all.idMenu.style.display = (bMenu) ? "block" : "none"<br>idML.className = (bMenu) ? "cOn" : "cOff"<br>idRL.className = (bMenu) ? "cOff" : "cOn"<br>return false<br>}<br></script></P>
<P><style><br><!--<br>A.cOn {text-decoration:none;font-weight:bolder}<br>#article {font: 12pt Verdana, geneva, arial, sans-serif; background: white; color: black; padding: 10pt 15pt 0 5pt}<br>#article P.start {text-indent: 0pt}<br>#article P {margin-top:0pt;font-size:10pt;text-indent:12pt}<br>#article #author {margin-bottom:5pt;text-indent:0pt;font-style: italic}<br>#pageList P {padding-top:10pt}<br>#article H3 {font-weight:bold}<br>#article DL, UL, OL {font-size: 10pt}<br>--><br></style><br><script><br><!--<br>function addList(url,desc) {<br>if ((navigator.appName=="Netscape") || (parseInt(navigator.appVersion)>=4)) {<br>var w=window.open("","_IDHTML_LIST_","top=0,left=0,width=475,height=150,history=no,menubar=no,status=no,resizable=no")<br>var d=w.document<br>if (!w._init) {<br>d.open()<br>d.write("<TITLE>Loading...</TITLE><EM>Loading...</EM>")<br>d.close()<br>d.location.replace("/assist/listing.asp?url="+escape(url)+"&desc="+escape(desc)) <br>w.opener=self <br>window.status="Personal Assistant (Adding): " + desc<br>} else {<br>window.status=w.addOption(url,desc) <br>w.focus()<br>}<br>}<br>else<br>alert("Your browser does not support the personal assistant.")<br>return false<br>}<br>// --><br></script></P>
<P><style><br> #board {cursor: default} <br> #board TD {width: 25px; height: 25px; }<br> </style></P>
<P><body><br><script><br> var size=10<br> var moves = 0<br> var off = size*2<br> var on = 0<br> var current = null<br> function doOver() {<br> if ((event.srcElement.tagName=="TD") && (current!=event.srcElement)) {<br> if (current!=null)<br> current.style.backgroundColor = current._background<br> event.srcElement._background = event.srcElement.style.backgroundColor<br> event.srcElement.style.backgroundColor = "lightgrey"<br> current = event.srcElement<br> }<br> }</P>
<P> function setColor(el) {<br> if ((el._background=="") || (el._background==null)) {<br> el.style.backgroundColor = "yellow"<br> el._background = "yellow" <br> } else {<br> el.style.backgroundColor = ""<br> el._background = "" <br> }<br> }</P>
<P> function countLights() {<br> off = 0; on = 0<br> for (var x=0; x < size; x++) <br> for (var y=0; y < size; y++) {<br> var p = board.rows[x].cells[y]<br> if (p._background=="yellow")<br> on++<br> else<br> off ++<br> }<br> document.all.on.innerText = on<br> if (off!=0) <br> document.all.off.innerText = off<br> else<br> document.all.off.innerText = "You Win!"<br> return (off==0)<br> }</P>
<P> function doClick() {<br> setColor(current) <br> var cellIdx = current.cellIndex<br> var rowIdx = current.parentElement.rowIndex<br> if (rowIdx>0) <br> setColor(board.rows[rowIdx-1].cells[cellIdx])<br> if (rowIdx<size-1)<br> setColor(board.rows[rowIdx+1].cells[cellIdx])<br> if (cellIdx>0) <br> setColor(board.rows[rowIdx].cells[cellIdx-1])<br> if (cellIdx<size-1)<br> setColor(board.rows[rowIdx].cells[cellIdx+1])<br> moves++<br> document.all.moves.innerText = moves<br> win = countLights()<br> if (win) {<br> board.onclick = null<br> board.onmouseover = null<br> current.style.background = "yellow"<br> }<br> }</P>
<P> function buildBoard() {<br> var str = "<TABLE ID=board ONSELECTSTART=\"return false\" ONCLICK=\"doClick()\" ONMOUSEOVER=\"doOver()\" cellspacing=0 cellpadding=0 border=5>"<br> for (var x=0; x < size; x++) {<br> str+="<TR>"<br> for (var y=0; y < size; y++) {<br> str+="<TD> </TD>"<br> } <br> str+="</TR>"<br> }<br> str+="</TABLE>"<br> return str<br> }</P>
<P> function newGame() {<br> size = document.all.gameSize.value<br> if (size<3)<br> size=3<br> if (size>15)<br> size=15<br> document.all.gameSize.value = size<br> document.all.board.outerHTML = buildBoard()<br> moves=0<br> document.all.moves.innerText = moves<br> countLights()<br><br> }<br> <br> </script></P>
<P><br><p align="center"><big><font color="#0000FF">在方格上点击,你可以将下面的方格全部填成黄色吗</font><strong><font<br>color="#FF0000"><big><big>?</big></big></font></strong></big></p></P>
<P><p align="center"><font color="#0000FF">快开动你智慧脑筋,看看有什么技巧与规律。</font></p></P>
<P><table border="1" width="100%"><br> <tr><br> <td width="50%"><div align="right"><table ID="score" border="0" width="284"><br> <tr><br> <td width="52">移动: </td><br> <td id="moves" width="33">0</td><br> <td width="42">灯灭:</td><br> <td id="off" width="36">25</td><br> <td width="46">灯亮:</td><br> <td id="on" width="39">0</td><br> </tr><br> </table><br> </div></td><br> <td width="50%"><div align="left"><table width="204"><br> <tr><br> <td width="54">大小: </td><br> <td width="41"><input ID="gameSize" TYPE="text" VALUE="10" SIZE="2"></td><br> <td width="97"><input ONCLICK="newGame()" TYPE="button" VALUE="开始游戏"></td><br> </tr><br> </table><br> </div></td><br> </tr><br></table></P>
<P><p align="center"><script><br> document.write(buildBoard())<br> </script></p><br></body></html></P></DIV>
[align=right][color=#000066][此贴子已经被作者于2007-6-26 10:27:02编辑过][/color][/align]
页:
[1]
