<!DOCTYPE HTML>
<head>
<title>基于JS+CSS打造的网页版俄罗斯方块游戏_网页代码站(www.webdm.cn)</title>
<style type="text/css">
body{ background-color:#eee}
#gameArea{ background-color:#fff; width: 293px; border:#fff 2px solid; margin:0 auto; font-size:12px;}
#gameArea .mainArea{ float:left; width:216px; height:324px; border:1px solid #fff;} #gameArea .mainArea div{ background-color:#EFEFEF; width:10px; height:10px; float:left; border:1px solid #fff; overflow:hidden;}
#gameArea .mainArea div.show{ background-color:#93D034;}
#gameArea .mainArea div.current{ background-color:#EFA53C;}
#gameArea .mainArea div.gameover{ background-color:#EFA53C;}
#gameArea .infoArea{ float:left; border-left:#fff solid 1px; width:74px; height:324px;}
#gameArea .score{ width:60px; margin: 20px auto 5px auto; color:#EFA53C; padding: 5px; font-size:18px; font-family:Arial, Helvetica, sans-serif; text-align:center;}
#gameArea .clear{ clear:both;} </style> <script type="text/javascript">
var boxGame = function( target ){ //初始化开始
var gameArea, mainArea, infoArea, scoreArea, grids;
( function(){ gameArea = document.createElement( 'div' );
gameArea.id = 'gameArea';
gameArea.innerHTML = function(){
var line = 486, html = '<div class="mainArea">';
while( line-- )
html += '<div></div>';
html += '<br class="clear"></div><div class="infoArea">';
html += '<div class="score">0</div>';
html += '</div><br class="clear">';
return html; }();
target = target || document.body; target.appendChild( gameArea );
mainArea = gameArea.firstChild; infoArea = mainArea.nextSibling; scoreArea = infoArea.firstChild; grids = function( area ){ var i = 0, x = 0, l = 28, elem, boxs = [ ]; var elems = mainArea.getElementsByTagName( 'div' ); while( --l ) boxs.push( [ ] ); l = 0; while( elem = elems[ i ] ){ if( x == 18 ){ l++; x = 0; } boxs[ l ].push({ elem : elem, status : 0 }); i++; x++; } return boxs; }( mainArea ); })(); var x1, x2, x3, x4, y1, y2, y3, y4, intervalDropMove, intervalCheckSuccess, gameStatus = 1, score = 0, nextGridsType = 0, className
<head>
<title>基于JS+CSS打造的网页版俄罗斯方块游戏_网页代码站(www.webdm.cn)</title>
<style type="text/css">
body{ background-color:#eee}
#gameArea{ background-color:#fff; width: 293px; border:#fff 2px solid; margin:0 auto; font-size:12px;}
#gameArea .mainArea{ float:left; width:216px; height:324px; border:1px solid #fff;} #gameArea .mainArea div{ background-color:#EFEFEF; width:10px; height:10px; float:left; border:1px solid #fff; overflow:hidden;}
#gameArea .mainArea div.show{ background-color:#93D034;}
#gameArea .mainArea div.current{ background-color:#EFA53C;}
#gameArea .mainArea div.gameover{ background-color:#EFA53C;}
#gameArea .infoArea{ float:left; border-left:#fff solid 1px; width:74px; height:324px;}
#gameArea .score{ width:60px; margin: 20px auto 5px auto; color:#EFA53C; padding: 5px; font-size:18px; font-family:Arial, Helvetica, sans-serif; text-align:center;}
#gameArea .clear{ clear:both;} </style> <script type="text/javascript">
var boxGame = function( target ){ //初始化开始
var gameArea, mainArea, infoArea, scoreArea, grids;
( function(){ gameArea = document.createElement( 'div' );
gameArea.id = 'gameArea';
gameArea.innerHTML = function(){
var line = 486, html = '<div class="mainArea">';
while( line-- )
html += '<div></div>';
html += '<br class="clear"></div><div class="infoArea">';
html += '<div class="score">0</div>';
html += '</div><br class="clear">';
return html; }();
target = target || document.body; target.appendChild( gameArea );
mainArea = gameArea.firstChild; infoArea = mainArea.nextSibling; scoreArea = infoArea.firstChild; grids = function( area ){ var i = 0, x = 0, l = 28, elem, boxs = [ ]; var elems = mainArea.getElementsByTagName( 'div' ); while( --l ) boxs.push( [ ] ); l = 0; while( elem = elems[ i ] ){ if( x == 18 ){ l++; x = 0; } boxs[ l ].push({ elem : elem, status : 0 }); i++; x++; } return boxs; }( mainArea ); })(); var x1, x2, x3, x4, y1, y2, y3, y4, intervalDropMove, intervalCheckSuccess, gameStatus = 1, score = 0, nextGridsType = 0, className