JavaScript writes Russian square

xiaoxiao2021-04-05  251

Russian square </ title > <style> body {margin: 0; background: black; width: 20;} # block_div {position: absolute; z-index: 1; width: 80;} # TABLE_DIV {Position: absolute ; z-index: 0; width: 320;} # nblock_div {position: absolute; z-index: 2; font: 48 system; color: red;} # title_div {position: absolute; left: 326; top: 7; Font-size: 9pt; color: white} #infobar_div {position: absolute; left: 396; top: 416;} <html> <head> <meta name = "title" content = "jscript simple tetris"> <meta Content = "text / html; charset = GB2312" http-equiv = content-type> <title> Russian square </ title> <style> body {margin: 0; background: black;} td {height: 20; width: 20 } #block_div {position: absolute; z-index: 1; width: 80;} #table_div {position: absolute; z-index: 0; width: 320;} #nblock_div {position: absolute; z-index: 2 FONT: 48 System; Color: Red;} #title_div {position: absolute; left: 326; top: 7; font-size: 9pt; color: white} #incobar_div {Position: absolute; le FT: 396;} # infobar2_div {position: absolute; left: 396; top: 480; font-size: 9pt; color: white} # infobar2_div a {color: 99ccff; font: system; text-decoration: None} </ style> <script id = clientendhandlersjs language = javascript> if (document.all) {var n_width = 800; var n_height = 600; var n_left = math.Round (Screen.width / 2) - n_width / 2; VAR n_top = math.Round (Screen.Height / 2) - n_height / 2; var n_incstep = 20; var curblcok, nextblock; var arr_curblock = new Array (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); Var Curx, Cury; Var Speed ​​= 1;</p> <p>Var MaxSpeed ​​= 9; var clr_per_line = 18; var gameOver = 0; var colors = new array ("# ​​999999", "# 80fff", "# 80ff80", "# 80ff80", "# fff00" , "# Ff8000", "# ff0000"); var Cid; var ncid; var blocks = new array ("TT_O1", "TT_T2", "TT_Z1", "TT_S1", "TT_L1", " TT_J1 "," TT_I2 "); var bid; var killedlines = 0; var tt_o1 = new Array (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1,0); var TT_O2 = New Array (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0); VAR TT_O3 = New Array ( 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0); VAR TT_O4 = New Array (0, 0, 0, 0, 0, 0 0, 0, 0, 1, 1, 0, 0, 1, 1, 0); VAR TT_T1 = New Array (0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0); VAR TT_T2 = New Array (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0); VAR TT_T3 = New Array (0,0,0,0,0,0,0,0,0,0); var TT_T4 = New Array (0,0,0 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0); VAR TT_Z1 = New Array (0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0); VAR TT_Z2 = New Array (0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1 , 0, 0); VAR TT_Z3 = New Array (0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0); VAR TT_Z4 = New Array (0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0); VAR TT_S1 = New Array (0, 0, 0, 0 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0); VAR TT_S2 = New Array (0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0); VAR TT_S3 = New Array (0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 , 0); VAR TT_S4 = New Array (0, 1, 0, 0, 0, 1, 1, 0, 0, 0); VAR TT_L1 = New Array (0 1, 0, 0, 0, 1, 0, 0, 0, 0); VAR TT_L2 = New Array (0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0, 0); VAR TT_L3 = New Array (0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0 , 0, 0, 1, 0); var TT_L4 = New Array (0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0); VAR TT_J1 = New Array (0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0); VAR TT_J2 =</p> <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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)} else alert ("You NEED IE4 TETRIS!") Function Dimension2 (Row, Col, Num) {var I = ROW * NUM COL; RETURN (this [i]);} Array.Prototype.getd = Dimension2; Function Showblock (X, Y, Block_Type, Color) {for (var i = 0; i <block_tbl.rows. Length; i ) {for (var j = 0; j <block_tbl.rows (i) .Cells.Length; J ) {var D2 = i * 4 j; if (block_type [d2] == 1) {block_tbl. Rows (i) .cells (j) .style.backfround = color;} else {block_tbl.rows (i) .Cells (j) .style.background = ";}}} block_div.style.pixelleft = x;</p> <p>Block_div.style.pixeltop = y;} Function Showblock1 (x, y, block_type, color, obj_tabid, obj_divid) {for (var i = 0; i <obj_tabid.rows.Length; i ) {for (var j = 0; J <obj_tabid.rows (i) .Cells.Length; J ) {var D2 = i * 4 j; if (block_type [d2] == 1) {Obj_tabid.Rows (i) .Cells (j) .style. Background = color;} else {obj_tabid.rows (i) .cells (j) .style.background = ";}}} Obj_divid.style.pixelleft = x; obj_divid.style.pixeltop = y;} Function Change (Inc ) {var type = curblock.substr (0,4); var num number = curblock.substr (curblock.Length-1); Num = PARSEINT (NUM) inc; IF (Num> 4 || Num <1) Num - = 4 * inc; INC; EVAL ("arr_tmp =" type ";"); if (curx, cury, arr_tmp) {curblock = type; evAl ("arr_curblock =" curblock " "); EVAL (" Showblock (Showblock_style.pixelletop, " Curblock ", Colors [" CID "]); ");}} Function Canmove (x, y, block ) {for (i = 0; i <4; i ) {for (j = 0; j <4; j ) {if (block.getd (i, j, 4) & table.getd (Y / n_incstep i, X / N_INCSTEP J, 16)) Return False;}} Return True;} Function Newblo CK () {curblock = nextblock; cid = ncid; bid = math.Round (math.Length-1); ncid = math.Round (Math.Random () * (Colors.Length- 1); NextBlock = blocks [bid]; EVAL ("arr_curblock =" curblock ";"); EVAL ("Showblock (120, 0," Curblock ", Colors [" CID "]); "); EVAL (" Arr_curblock = " Curblock "; "); EVAL (" Showblock1 (466, 116, " NextBlock "</p> <p>, Colors [" NCID "], NBLOCK_TBL, NBLOCK_DIV); ");} Function SaveBlock () {for (i = 0; i <4; i ) {for (j = 0; j <4; j ) { Table [(CURY / N_INCSTEP I) * 16 CURX / N_INCSTEP J] | = arr_curblock [i * 4 j]; if (Arr_curblock [i * 4 j] == 1) IF ((Cury / n_incstep I <21) && (CURX / N_INCSTEP J> 1) && (CURX / N_INCSTEP J <14)) Table_TBL.ROWS (CURY / N_INCSTEP I) .Cells (CURX / N_INCSTEP J) .Style.Background = Colors [CID]; if (Table / N_INCSTEP I) * 16 CURX / N_INCSTEP J]! = 1) Table_TBL.ROWS (CURY / N_INCSTEP I) .Cells (CURX / N_INCSTEP J) .Style. Background = "black";}}} function Delline (line) {for (i = line; i> 0; i -) {for (j = 2; j <14; j ) {Table [i * 16 J ] = Table [(i-1) * 16 j];}} Table_TBL.DELETEROW (LINE); TABLE_TBL.INSERTROW (0); for (i = 0; i <16; i ) {TABLE_TBL.ROWS (0) .insertcell (); IF (i <2 || i> 13) Table_TBL.ROWS (0) .Cells (i) .Style.Background = "navy";} killedlines ; crale.innerText = PARSEINT (CLL.INNNERTEXT) 1;} function Dellines () {var C, D, I, J; D = 0; CURY = Block_div.style.pixeltop; for (i = (CURY / 20 3); I> Cury / 20-1; i -) {c = 0; for (j = 2; j <14; j ) {if (isnan (table [i * 16 j]) || i == 21) Break; C = Table [i * 16 j];} if (c == 12) {Delline (i); i ; d ;}} f (d> 0) sco.innerText = PARSEINT SCO.INNERTEXT) D * D * 36;} function lucifer () {for (var i = 2; i <14; i ) {IF (Table [16 i] == 1) Return true;} return false; } function gameOver () {GameOver = 1; clearinterval (gameinterval); block_div.innerhtml = ""; for (i = 0; i <21; i ) {for (j = 2; J <</p> <p>14; J ) {setTimeout ("Table_TBL.Rows (" i ") .Cells (" J ") .Style.Background = Colors [Math.Round (Math.Radom () * 7)];", 16 * i * j);}} nblock_div.innerhtml = "game over";} function document_onkeydown () {if (GameOver == 1) Return; with (block_div.style) {curX = Pixelleft; cury = Pixeltop; Switch; Event.keycode) {Case 37: IF (CANMOVE (CURX-N_INCSTEP, CURY, ARR_CURBLOCK) Pixelleft- = n_incstep; break; case 38: Change (1); Break; Case 39: IF (CREAKOVE (CURX N_INCSTEP, CURY , arr_curBlock)) pixelLeft = n_IncStep; break; case 40: if (CanMove (curX, curY n_IncStep, arr_curBlock)) {pixelTop = n_IncStep;} else {SaveBlock (); DelLines (); if (Lucifer ()) {GameOver ();} sco.innertext = PARSEINT (SCo.innertext) 2; newblock ();} Break; case 32: if (pause == 0) {ClearInterVal (GameInterval); Pause = 1;} else {GameInterval = WINDOW.SETINTERVAL ("Handle_Interval ()", (MaxSpeed-Speed ​​ 1) * 60); Pause = 0;} Break; Case 90: Change (1); Break; Case 88: Change (-1); Break; DEFAULT:}}} Function Handle_Interval () {curX = block_div.s tyle.pixelLeft; curY = block_div.style.pixelTop; if (CanMove (curX, curY n_IncStep, arr_curBlock)) {block_div.style.pixelTop = n_IncStep;} else {SaveBlock (); DelLines (); if (Lucifer () ) {GameOver (); return;} sco.innerText = parseInt (sco.innerText) 2 newBlock ();} if (killedlines> = clr_per_line) {killedlines- = clr_per_line; if (speed <maxspeed) speed ; else speed = MaxSpeed; spd.innerText = speed; clearinterval (gameinterval); GameInterval = Window.setInterval ("Handle_Interval ()", (MaxSpeed-Speed ​​ 1) * 60);}} </ script> <</p> <p>SCRIPT LANGUAGE = javascript FOR = document EVENT = onkeydown> if (document.all) document_onkeydown () </ SCRIPT> </ HEAD> <BODY LANGUAGE = javascript topmargin = "0" leftmargin = "0" scroll = "no"> < DIV ID = block_div style = "Left: 60; TOP: 0"> <Table ID = block_tbl border = 0 cellspacing = 0 cellpadding = 0> <script> if (document.all) {for (var i = 0; i < 4; i ) {document.write ("<tr>"); for (var j = 0; j <4; j ) {document.write ("<td style = /" border: 1 solid black; / "> </ td> ");} Document.write (" </ TR> ");}}} </ script> </ table> </ div> <div id = nblock_div> <Table ID = NBLOCK_TBL BORDER = 0 Cellspacing = 0 Cellpadding = 0> <script> if (document.all) {for (var i = 0; i <4; i ) {document.write ("<tr>"); for (var j = 0; J <4 ; J ) {document.write ("<TD style = /" Height: 40; width: 40; border: 1 outset black; / "> </ td>");} Document.write ("</ TR>" }} </ script> </ table> </ div> <div id = Table_div> <Table ID = Table_TBL Border = 0 Cellspacing = 0 Cellpadding = 0> <script> if (document.all) {for (VAR i = 0; i <22; i ) {document.write ("<tr>"); for (var j = 0; j <16; j ) {var d2 = i * 16 J; if (Table [D2] == 1) Document.write ("<TD BGCOLOR = Navy> </ TD>"); Else Document.write ("<TD Style = /" Background: Black; / "> </ td>");} Document.write ("</ TR>");}} </ script> </ table> <</p> <p>/ DIV> <div id = Title_div Nowrap Style = "Width: 407; Height: 24; Font-Style: Normal; Font-Variant: Normal; Font-Weight: Normal; Font-Size: 12> <p align =" CENTER> Please enter the game speed (0-9): <input type = "text" size = 3 id = "spetedin" style = "font-size: 9pt" name = "superso"> <button onclick = "begintet ) "ID =" but "> <font style =" font-size: 9pt "face =" arial black "color =" # ff0000 "> OK </ font> </ button> </ div> <div id = infobao_div > <table border = 1 bordercolor = # 000000 cellspacing = 0 cellpadding = 0> <tr align = center> <TD style = "Color: 99ccff; font-size: 9pt; width: 60;"> Game speed: </ td > <TD style = "color: red; font-size: 9pt;" ID = SPD> 1 </ TD> <TD style = "Color: 99ccff; font-size: 9pt; width: 60;"> Total score: </ td> <TD style = "color: red; font-size: 9pt;" ID = SCO> 0 </ TD> <TD style = "Color: 99ccff; font-size: 9pt; width: 60;">> Clear line number: </ td> <TD style = "color: red; font-size: 9pt;" ID = CLL> 0 </ td> <script id = mainsection Language = javascript> if (document.all) {ncid = math.Round (Math.Random () * (Colors.Length-1)); bid = math.Round (Math.random () * (blocks.l ength-1)); nextBlock = blocks [bid]; NewBlock ();} function begintet () {document.all.speedin.disabled = true document.all.but.disabled = true speed = parseInt (document.all.speedin .value); IF (isnan (speted) || speted == null || speted> maxSpeed ​​|| Speed ​​<</p> <p>1) Speed ​​= 1; spd.innerText = speed; gameinterval = window.setInterval ("Handle_Interval ()", (MaxSpeed-Speed ​​ 1) * 60);} </ script> </ body> </ html> # infobar2_div {Position: Absolute; Left: 396; Top: 480; font-size: 9pt; color: white} # infobar2_div a {color: 99ccff; font: system; text-decoration: none} </ stop> <script id = clientsEventHandlersjs Language = javascript> if (document.all) {var n_width = 800; var n_height = 600; var n_left = math.Round (Screen.Width / 2) - n_width / 2; var N_top = math.Round (Screen.Height / 2) - n_height / 2; var n_incstep = 20; var curblcok, nextblock; var arr_curblock = new array (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , 0, 0); var speted = 1; var maxSpeed ​​= 9; var clr_per_line = 18; var pause = 0; var gameover = 0; var colors = new array ("# ​​999999", "# 0000FF "" # 80ffffff "," # 80ff80 "," # fff00 "," # ff00ff "," # ff0000 "); VAR CID; var ncid; var blocks = new array (" tt_o1 "," TT_T2 "," TT_Z1 "," TT_S1 "," TT_L1 "," TT_J1 "," TT_I2 "); var bid; var killedlines = 0; var tt_o1 = new Array (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0); var TT_O2 = NE W Array (0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0); VAR TT_O3 = New Array (0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0); VAR TT_O4 = New Array (0, 0, 0, 0, 0, 0, 0, 0, 1 , 1, 0, 0, 1, 1, 0); var TT_T1 = New Array (0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0); var TT_T2 = New Array (0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0); VAR TT_T3 = New Array (0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0); VAR TT_T4 = New Array (0, 0, 0, 0, 0, 1, 0 0, 1, 1, 1, 0, 0, 0, 0); var TT_Z1 = New Array (0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0); var tt_z2 =</p> <p>New array (0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 0); VAR TT_Z3 = New Array (0, 0, 0, 0, 0, 1, 1, 0, 0, 0); VAR TT_Z4 = New Array (0, 0, 1, 0, 0, 1, 1, 0, 0, 1 0, 0, 0, 0, 0); var TT_S1 = New Array (0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0); var TT_S2 = New Array (0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0); VAR TT_S3 = New Array (0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0); VAR TT_S4 = New Array (0, 1, 0, 0, 0, 1, 1 0, 0, 0, 1, 0, 0, 0); VAR TT_L1 = New Array (0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0); VAR TT_L2 = New Array (0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 0); VAR TT_L3 = New Array (0,0,0,0,0,0,0,0,1,0); var TT_L4 = New Array (0,0,0,0,0 0, 1, 1, 1, 0, 1, 0, 0, 0, 0); VAR TT_J1 = New Array (0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0); VAR TT_J2 = New Array (0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0 , 0); var TT_J3 = New Array (0, 0, 0, 0, 0, 1, 1, 0, 0); VAR TT_J4 = New Array (0 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0); VAR TT_I1 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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1)} elselert ("You NEED IE4 TO Play Tetris!") Function Dimension 2 (Row, Col, Num) {var i = row * Num Col; Return (this [i]);} array. Prototype.getd = Dimension2; Function Showblock (x, y, block_t Ype, color) {for (var i = 0; i <block_tbl.rows.Length; i ) {for (var j = 0; j <block_tbl.rows (i) .Cells.Length; J ) {var D2 = i * 4 J; if (block_type [d2] == 1) {Block_TBL.ROWS (i) .Cells (j) .style.Background = Color;} else {block_tbl.rows (i) .Cells (j) .style . background = "";}}} block_div.style.pixelleft = x; block_div.style.pixeltop = y;} Function Showblock1 (x, y, block_type, color, obj_tabid, obj_divid) {for (var i = 0; i <obj_tabid.Rows.Length; i ) {for (var j = 0; j <obj_tabid.rows (i) .Cells.Length; J </p> <p>) {Var D2 = i * 4 j; if (block_type [d2] == 1) {OBJ_TABID.ROWS (i) .Cells (j) .style.background = color;} else {obj_tabid.rows (i). Cells (j) .style.background = "";}}} Obj_divid.style.pixelleft = x; obj_divid.style.pixeltop = y;} function change (inc) {var type = curblock.substr (0,4); VAR Num = curblock.substr (curblock.Length-1); Num = parseint (num) inc; if (Num> 4 || Num <1) Num - = 4 * inc; type = num; evAl ("arr_tmp = " Type "; "); if (CANMOVE (CURX, Cury, Arr_TMP) {curblock = type; evAl (" arr_curblock = " curblock "; "); EVAL (" Showblock (block_div.style.pixelleft Block_div.style.pixeltop, " Curblock ", Colors [" CID "]); ");}} Function CANMOVE (X, Y, Block) {for (i = 0; i <4; i ) {For (j = 0; j <4; j ) {IF (block.getd (i, j, 4) & Table.getd (Y / n_incstep i, x / n_incstep j, 16)) Return False;}} Return True;} functi On newblock () {curblock = nextblock; cid = ncid; bid = math.round (math.RandM () * (math.RAndom () * (math.random () * (colors.length -1)); NextBlock = Blocks [BID]; EVAL ("arr_curblock =" curblock ";"); EVAL ("Showblock (120, 0," Curblock ", Colors [" CID "]) ; "); EVAL (" Arr_curblock = " Curblock "; "); EVAL (" Showblock1 (466, 116, " NextBlock "</p> <p>, Colors [" NCID "], NBLOCK_TBL, NBLOCK_DIV); ");} Function SaveBlock () {for (i = 0; i <4; i ) {for (j = 0; j <4; j ) { Table [(CURY / N_INCSTEP I) * 16 CURX / N_INCSTEP J] | = arr_curblock [i * 4 j]; if (Arr_curblock [i * 4 j] == 1) IF ((Cury / n_incstep I <21) && (CURX / N_INCSTEP J> 1) && (CURX / N_INCSTEP J <14)) Table_TBL.ROWS (CURY / N_INCSTEP I) .Cells (CURX / N_INCSTEP J) .Style.Background = Colors [CID]; if (Table / N_INCSTEP I) * 16 CURX / N_INCSTEP J]! = 1) Table_TBL.ROWS (CURY / N_INCSTEP I) .Cells (CURX / N_INCSTEP J) .Style. Background = "black";}}} function Delline (line) {for (i = line; i> 0; i -) {for (j = 2; j <14; j ) {Table [i * 16 J ] = Table [(i-1) * 16 j];}} Table_TBL.DELETEROW (LINE); TABLE_TBL.INSERTROW (0); for (i = 0; i <16; i ) {TABLE_TBL.ROWS (0) .insertcell (); IF (i <2 || i> 13) Table_TBL.ROWS (0) .Cells (i) .Style.Background = "navy";} killedlines ; Cll.innertext = PARS EINT (CLL.INNERTEXT) 1;} function Dellines () {var C, D, I, J; D = 0; CURY = Block_div.style.pixeltop; for (i = (CURY / 20 3); i> Cury / 20-1; I -) {c = 0; for (j = 2; j <14; j ) {ix (isnan (Table [i * 16 j]) || i == 21) Break; C = Table [i * 16 j];} if (c == 12) {Delline (i); i ; d ;}} if (d> 0) sco.innertext =</p> <p>PARSEINT (SCo.innertext) D * D * 36;} function lucifer () {for (var i = 2; i <14; i ) {if (Table [16 i] == 1) Return true;} return Function gameOver () {GameOver = 1; ClearInterVal (GameInterval); Block_div.innerhtml = ""; for (i = 0; i <21; i ) {for (j = 2; j <14; j ) { SetTimeout ("Table_TBL.Rows (" i ") .Cells (" J ") .Style.Background = Colors [Math.Round (Math.Radom () * 7)];", 16 * i * j );}} nblock_div.innerHTML = "Game Over";} function document_onkeydown () {if (gameover == 1) return; with (block_div.style) {curX = pixelLeft; curY = pixelTop; switch (event.keyCode) { case 37: if (CanMove (curX-n_IncStep, curY, arr_curBlock)) pixelLeft- = n_IncStep; break; case 38: Change (1); break; case 39: if (CanMove (curX n_IncStep, curY, arr_curBlock)) pixelLeft = N_INCSTEP; Break; Case 40: IF (CANMOVE (CURX, Cury n_IncStep, arr_curBlock)) {pixelTop = n_IncStep;} else {SaveBlock (); DelLines (); if (Lucifer ()) {GameOver (); return;} sco.innerText = parseInt (sco.innerText) 2; NewBlock ( );} Break; Case 32: if (pause == 0) {ClearInterVal (GameInterval); pause = 1;} else {gameinterval =</p> <p>Window.setInterval ("Handle_Interval ()", (MaxSpeed-Speed ​​ 1) * 60); Pause = 0;} Break; Case 90: Change (1); Break; Case 88: Change (-1); Break; Default :}}} function Handle_Interval () {curX = block_div.style.pixelLeft; curY = block_div.style.pixelTop; if (CanMove (curX, curY n_IncStep, arr_curBlock)) {block_div.style.pixelTop = n_IncStep;} else { Saveblock (); Dellines (); if (lucifer ()) {GameOver (); return;} sco.innertext = parseint (sco.innertext) 2 newblock ();} if (killedlines> = CLR_PER_LINE) {killedlines- = clr_per_line; if (speed <maxspeed) speed ; else speed = maxspeed; spd.innerText = speed; clearInterval (gameInterval); gameInterval = window.setInterval ( "Handle_Interval ()", (maxspeed-speed 1) * 60);} } </ Script> <script langu AGE = javascript FOR = document EVENT = onkeydown> if (document.all) document_onkeydown () </ SCRIPT> </ HEAD> <BODY LANGUAGE = javascript topmargin = "0" leftmargin = "0" scroll = "no"> <div ID = block_div style = "Left: 60; TOP: 0"> <Table ID = block_tbl border = 0 cellspacing = 0 cellpadding = 0> <script> if (document.all) {for (var i = 0; i <4 i ) {document.write ("<tr>"); for (var j = 0; j <4; j ) {document.write ("<td style = /" border: 1 solid black; / "> < / TD> ");</p> <p>} Document.write ("</ TR>");}} </ script> </ table> </ div> <div id = nblock_div> <Table ID = nblock_tbl border = 0 Cellspacing = 0 cellpadding = 0> <script > IF (Document.all) {for (var i = 0; i <4; i ) {document.write ("<tr>"); for (var j = 0; j <4; j ) {document.write ("<TD Style = /" Height: 40; Width: 40; Border: 1 OutSet Black; / "> </ TD>");} Document.write ("</ TR>");}} </ script > </ table> </ div> <div id = Table_div> <Table ID = Table_TBL Border = 0 Cellspacing = 0 Cellpadding = 0> <script> if (document.all) {for (var i = 0; i <22 ; i ) {document.write ("<tr>"); for (var j = 0; j <16; j ) {var D2 = i * 16 j; if (Table [D2] == 1) Document. Write ("<TD BGColor = Navy> </ TD>"); Else Document.write ("<TD Style = /" Background: Black; / "> </ TD>");} Document.write ("</ Tr> ");}} </ script> </ table> </ div> <div id = Title_div noWrap Style =" Width: 407; Height: 24; Font-Style: Normal; Font-Variant: Normal; FONT- Weight: Normal; Font-Size: 12> <p align = "center"> Please enter the game speed (0-9): <input type = "text" size = 3 id = "spetedin" style = "font-size: 9pt" name = "superso"> <button onclick = "begintet ()" id = "but"> <font style = "font-size: 9pt" face = "Arial Black "Color =" # ff0000 "> OK <</p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-132190.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="132190" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.033</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'DkyLkhqKf_2BQrlmJXG29lfI9tnZ0snfp2Hnc7RN4s_2BFfaZFBI_2FsnFUQMf47jyHO3rcpRi8oxkKqVkpE0sgeuI_2BA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>