Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <style type="text/css">
- table, td,tr{
- border:2px solid black;
- margin: auto;
- font-size: 70px;
- text-align: center;
- vertical-align: middle;
- border-collapse: collapse;
- }
- td{
- width: 90px;
- height:90px;
- }
- html{
- font-family: 'Permanent Marker', cursive;
- background-image: linear-gradient(125deg,#FFFF00,#FF4000,#5FB404,#00BFFF);
- background-size: 800% 800%;
- animation: animacao 5s infinite;
- text-align: center;
- }
- @keyframes animacao{
- 0%{
- background-position: 0% 50%;
- }
- 50%{
- background-position: 100% 50%;
- }
- 100%{
- background-position: 0% 50%;
- }
- }
- h1{
- color:white;
- }
- .pretas{
- background-color: white;
- }
- .brancas{
- background-color: lightgrey;
- }
- input{
- width: 400px;
- height: 100px;
- font-size:50px;
- }
- </style>
- <html>
- <head>
- <title>BATALHA DE PEÕES</title>
- </head>
- <body>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <h1>BATALHA DE PEÕES</h1>
- <table>
- <tr>
- <td onClick="joga(1);"class="brancas" id="1"> </td>
- <td onClick="joga(2);"class="pretas" id="2"> </td>
- <td onClick="joga(3);"class="brancas" id="3"> </td>
- <td onClick="joga(4);"class="pretas" id="4"> </td>
- <td onClick="joga(5);"class="brancas" id="5"> </td>
- <td onClick="joga(6);"class="pretas" id="6"> </td>
- <td onClick="joga(7);"class="brancas" id="7"> </td>
- <td onClick="joga(8);"class="pretas" id="8"> </td>
- </tr>
- <tr>
- <td onClick="joga(9);" class="pretas" id="9"> ♟ </td>
- <td onClick="joga(10);" class="brancas" id="10">♟</td>
- <td onClick="joga(11);" class="pretas" id="11">♟</td>
- <td onClick="joga(12);" class="brancas" id="12">♟</td>
- <td onClick="joga(13);" class="pretas" id="13">♟</td>
- <td onClick="joga(14);" class="brancas" id="14">♟</td>
- <td onClick="joga(15);" class="pretas" id="15">♟</td>
- <td onClick="joga(16);" class="brancas" id="16">♟</td>
- </tr>
- <tr>
- <td onClick="joga(17);" class="brancas"id="17"> </td>
- <td onClick="joga(18);" class="pretas" id="18"> </td>
- <td onClick="joga(19);" class="brancas"id="19"> </td>
- <td onClick="joga(20);" class="pretas" id="20"> </td>
- <td onClick="joga(21);" class="brancas"id="21"> </td>
- <td onClick="joga(22);" class="pretas" id="22"> </td>
- <td onClick="joga(23);" class="brancas"id="23"> </td>
- <td onClick="joga(24);" class="pretas" id="24"> </td>
- </tr>
- <tr>
- <td onClick="joga(25);" class="pretas" id="25"> </td>
- <td onClick="joga(26);" class="brancas"id="26"> </td>
- <td onClick="joga(27);" class="pretas" id="27"> </td>
- <td onClick="joga(28);" class="brancas"id="28"> </td>
- <td onClick="joga(29);" class="pretas" id="29"> </td>
- <td onClick="joga(30);" class="brancas"id="30"> </td>
- <td onClick="joga(31);" class="pretas" id="31"> </td>
- <td onClick="joga(32);" class="brancas"id="32"> </td>
- </tr>
- <tr>
- <td onClick="joga(33);" class="brancas"id="33"> </td>
- <td onClick="joga(34);" class="pretas" id="34"> </td>
- <td onClick="joga(35);" class="brancas"id="35"> </td>
- <td onClick="joga(36);" class="pretas" id="36"> </td>
- <td onClick="joga(37);" class="brancas"id="37"> </td>
- <td onClick="joga(38);" class="pretas" id="38"> </td>
- <td onClick="joga(39);" class="brancas"id="39"> </td>
- <td onClick="joga(40);" class="pretas" id="40"> </td>
- </tr>
- <tr>
- <td onClick="joga(41);" class="pretas" id="41"> </td>
- <td onClick="joga(42);" class="brancas"id="42"> </td>
- <td onClick="joga(43);" class="pretas" id="43"> </td>
- <td onClick="joga(44);" class="brancas"id="44"> </td>
- <td onClick="joga(45);" class="pretas" id="45"> </td>
- <td onClick="joga(46);" class="brancas"id="46"> </td>
- <td onClick="joga(47);" class="pretas" id="47"> </td>
- <td onClick="joga(48);" class="brancas"id="48"> </td>
- </tr>
- <tr>
- <td onClick="joga(49);" class="brancas"id="49">♙</td>
- <td onClick="joga(50);" class="pretas" id="50">♙</td>
- <td onClick="joga(51);" class="brancas"id="51">♙</td>
- <td onClick="joga(52);" class="pretas" id="52">♙</td>
- <td onClick="joga(53);" class="brancas"id="53">♙</td>
- <td onClick="joga(54);" class="pretas" id="54">♙</td>
- <td onClick="joga(55);" class="brancas"id="55">♙</td>
- <td onClick="joga(56);" class="pretas" id="56">♙</td>
- </tr>
- <tr>
- <td onClick="joga(57);"class="pretas" id="57"> </td>
- <td onClick="joga(58);"class="brancas" id="58"> </td>
- <td onClick="joga(59);"class="pretas" id="59"> </td>
- <td onClick="joga(60);"class="brancas" id="60"> </td>
- <td onClick="joga(61);"class="pretas" id="61"> </td>
- <td onClick="joga(62);"class="brancas" id="62"> </td>
- <td onClick="joga(63);"class="pretas" id="63"> </td>
- <td onClick="joga(64);"class="brancas" id="64"> </td>
- </tr>
- </table>
- <br>
- <input type="button"id="clica"value="REINICIA JOGO" onclick="reinicia();" name="">
- <script type="text/javascript">
- var jogada=1;
- var i,c,x,a,verde=0,diagonal=0;
- var jogo=new Array(100);
- //colocar o background-color nos sítios adequados
- for(i=1;i<=64;i++){
- jogo[i]=0;
- }
- for(i=1;i<=64;i++){
- if(i==49 || i==55 || i==51|| i==53){
- jogo[i]=1;
- }
- if(i==50 || i==52 || i==54|| i==56){
- jogo[i]=2;
- }
- if(i==9 || i==11 || i==13|| i==15){
- jogo[i]=3;
- }
- if(i==10 || i==12 || i==14|| i==16){
- jogo[i]=4;
- }
- }
- function joga(x){
- if(jogada==1){
- if(verde==0){
- if(jogo[x]==1 || jogo[x]==2){
- if(x<=56 && x>= 49){
- if(x==49){
- if(jogo[x-7]==3 || jogo[x-7]==4){
- document.getElementById(x-7).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- }
- }
- if(x==56){
- if(jogo[x-9]==3 || jogo[x-9]==4){
- document.getElementById(x-9).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- }
- }
- if(x!=49 && x!=56){
- if(jogo[x-7]==3 || jogo[x-7]==4){
- document.getElementById(x-7).style.backgroundColor = 'lightgreen';
- }
- if(jogo[x-9]==3 || jogo[x-9]==4){
- document.getElementById(x-9).style.backgroundColor = 'lightgreen';
- }
- }
- if(jogo[x-8]==3 || jogo[x-8]==4 || jogo[x-8]==1 || jogo[x-8]==2){
- verde=0;
- alert('Não pode jogar em nenhuma casa!');
- }
- else if(jogo[x-16]==3 || jogo[x-16]==4 || jogo[x-8]==1 || jogo[x-8]==2){
- document.getElementById(x-8).style.backgroundColor = "lightgreen";
- verde=1;
- c=x;
- }
- else{
- document.getElementById(x-8).style.backgroundColor = "lightgreen";
- document.getElementById(x-16).style.backgroundColor = "lightgreen";
- verde=1;
- c=x;
- }
- }
- else{
- if(x==9 ||x==17 ||x==25 ||x==33 ||x==41){
- if(jogo[x-7]==3 || jogo[x-7]==4){
- document.getElementById(x-7).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- }
- else if(x==16 || x==24 || x==32 || x==40 || x==48){
- if(jogo[x-9]==3 || jogo[x-9]==4){
- document.getElementById(x-9).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- }
- else{
- if(jogo[x-9]==3 || jogo[x-9]==4){
- document.getElementById(x-9).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- if(jogo[x-7]==3 || jogo[x-7]==4){
- document.getElementById(x-7).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- }
- if((jogo[x-8]==3 || jogo[x-8]==4 || jogo[x-8]==1 || jogo[x-8]==2) && diagonal==0){
- verde=0;
- alert('Não pode jogar em nenhuma casa!');
- }
- else if((jogo[x-8]==3 || jogo[x-8]==4 || jogo[x-8]==1 || jogo[x-8]==2) && diagonal==1){
- c=x;
- verde=1;
- diagonal=0;
- }
- else{
- document.getElementById(x-8).style.backgroundColor = "lightgreen";
- c=x;
- verde=1;
- }
- }
- }
- }
- else{
- if(document.getElementById(x).style.backgroundColor == "lightgreen"){
- if(jogo[c]==1){
- if((c==9 ||c==17 ||c==25 ||c==33 ||c==41||c==49) && x>=9){
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c-16).style.backgroundColor = 'lightgrey';
- document.getElementById(c-8).style.backgroundColor = 'white';
- document.getElementById(c-7).style.backgroundColor = 'lightgrey';
- }
- else if((c==16 ||c==24 ||c==32 ||c==40 ||c==48 || c==56) && x>=9){
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c-8).style.backgroundColor = 'lightgrey';
- document.getElementById(c-16).style.backgroundColor = 'white';
- document.getElementById(c-9).style.backgroundColor = 'lightgrey';
- }
- else if(x>=9){
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c-8).style.backgroundColor = 'white';
- document.getElementById(c-16).style.backgroundColor = 'lightgrey';
- document.getElementById(c-7).style.backgroundColor = 'lightgrey';
- document.getElementById(c-9).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML='';
- document.getElementById(x).style.backgroundColor = 'red';
- }
- jogada=2;
- verde=0;
- if(c-x==8){
- jogo[x]=2;
- }
- else{
- jogo[x]=1;
- }
- jogo[c]=0;
- }
- else if(jogo[c]==2){
- if((c==9 ||c==17 ||c==25 ||c==33 ||c==41||c==49) && x>=9){
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c-8).style.backgroundColor = 'lightgrey';
- document.getElementById(c-16).style.backgroundColor = 'white';
- document.getElementById(c-7).style.backgroundColor = 'white';
- }
- else if((c==16 ||c==24 ||c==32 ||c==40 ||c==48 || c==56) && x>=9){
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c-8).style.backgroundColor = 'lightgrey';
- document.getElementById(c-16).style.backgroundColor = 'white';
- document.getElementById(c-9).style.backgroundColor = 'white';
- }
- else if(x>=9){
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c-8).style.backgroundColor = 'lightgrey';
- document.getElementById(c-16).style.backgroundColor = 'white';
- document.getElementById(c-7).style.backgroundColor = 'white';
- document.getElementById(c-9).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML='';
- document.getElementById(x).style.backgroundColor = 'red';
- }
- jogada=2;
- verde=0;
- if(c-x==8){
- jogo[x]=1;
- }
- else{
- jogo[x]=2;
- }
- jogo[c]=0;
- }
- }
- if(c==x && jogo[x]==1){
- if(c==9 ||c==17 ||c==25 ||c==33 ||c==41||c==49){
- document.getElementById(x-8).style.backgroundColor = 'white';
- document.getElementById(x-16).style.backgroundColor = 'lightgrey';
- document.getElementById(x-7).style.backgroundColor = 'lightgrey';
- }
- else if(c==16 ||c==24 ||c==32 ||c==40 ||c==48 || c==56){
- document.getElementById(x-8).style.backgroundColor = 'white';
- document.getElementById(x-16).style.backgroundColor = 'lightgrey';
- document.getElementById(x-9).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(x-8).style.backgroundColor = 'white';
- document.getElementById(x-16).style.backgroundColor = 'lightgrey';
- document.getElementById(x-7).style.backgroundColor = 'lightgrey';
- document.getElementById(x-9).style.backgroundColor = 'lightgrey';
- }
- verde=0;
- }
- else if(c==x && jogo[x]==2){
- if(c==9 ||c==17 ||c==25 ||c==33 ||c==41||c==49){
- document.getElementById(x-8).style.backgroundColor = 'lightgrey';
- document.getElementById(x-16).style.backgroundColor = 'white';
- document.getElementById(x-7).style.backgroundColor = 'white';
- }
- else if(c==16 ||c==24 ||c==32 ||c==40 ||c==48 || c==56){
- document.getElementById(x-8).style.backgroundColor = 'lightgrey';
- document.getElementById(x-16).style.backgroundColor = 'white';
- document.getElementById(x-9).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(x-8).style.backgroundColor = 'lightgrey';
- document.getElementById(x-16).style.backgroundColor = 'white';
- document.getElementById(x-7).style.backgroundColor = 'white';
- document.getElementById(x-9).style.backgroundColor = 'white';
- }
- verde=0;
- }
- verifica();
- }
- }
- else{
- if(verde==0){
- if(jogo[x]==3 || jogo[x]==4){
- if(x<=16 && x>= 9){
- if(x==9){
- if(jogo[x+9]==1 || jogo[x+9]==2){
- document.getElementById(x+9).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- }
- }
- if(x==16){
- if(jogo[x+7]==1 || jogo[x+7]==2){
- document.getElementById(x+7).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- }
- }
- if(x!=16 && x!=9){
- if(jogo[x+9]==1 || jogo[x+9]==2){
- document.getElementById(x+9).style.backgroundColor = 'lightgreen';
- }
- if(jogo[x+7]==1 || jogo[x+7]==2){
- document.getElementById(x+7).style.backgroundColor = 'lightgreen';
- }
- }
- if(jogo[x+8]==1 || jogo[x+8]==2 || jogo[x+8]==1 || jogo[x+8]==2){
- verde=0;
- alert('Não pode jogar em nenhuma casa!');
- }
- else if(jogo[x+16]==3 || jogo[x+16]==4 || jogo[x+16]==1 || jogo[x+16]==2){
- document.getElementById(x+8).style.backgroundColor = "lightgreen";
- verde=1;
- c=x;
- }
- else{
- document.getElementById(x+8).style.backgroundColor = "lightgreen";
- document.getElementById(x+16).style.backgroundColor = "lightgreen";
- verde=1;
- c=x;
- }
- }
- else{
- if(x==9 ||x==17 ||x==25 ||x==33 ||x==41){
- if(jogo[x+9]==1 || jogo[x+9]==2){
- document.getElementById(x+9).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- }
- if(x==16 || x==24 || x==32 || x==40 || x==48){
- if(jogo[x+7]==1 || jogo[x+7]==2){
- document.getElementById(x+7).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- }
- else{
- if(jogo[x+7]==1 || jogo[x+7]==2){
- document.getElementById(x+7).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- if(jogo[x+9]==1 || jogo[x+9]==2){
- document.getElementById(x+9).style.backgroundColor = 'lightgreen';
- verde=1;
- c=x;
- diagonal=1;
- }
- }
- if((jogo[x+8]==3 || jogo[x+8]==4 || jogo[x+8]==1 || jogo[x+8]==2) && diagonal==0){
- verde=0;
- alert('Não pode jogar em nenhuma casa!');
- }
- else if((jogo[x+8]==3 || jogo[x+8]==4 || jogo[x+8]==1 || jogo[x+8]==2) && diagonal==1){
- c=x;
- verde=1;
- diagonal=0;
- }
- else{
- document.getElementById(x+8).style.backgroundColor = "lightgreen";
- c=x;
- verde=1;
- }
- }
- }
- }
- else{
- if(document.getElementById(x).style.backgroundColor == "lightgreen"){
- verifica();
- if(jogo[c]==4){
- if((c==9 ||c==17 ||c==25 ||c==33 ||c==41) && x<=58){
- document.getElementById(x).innerHTML='♟';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c+8).style.backgroundColor = 'white';
- document.getElementById(c+16).style.backgroundColor = 'lightgrey';
- document.getElementById(c+9).style.backgroundColor = 'lightgrey';
- }
- else if((x==16 || x==24 || x==32 || x==40 || x==48) && x<=58){
- document.getElementById(x).innerHTML='♟';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c+8).style.backgroundColor = 'white';
- document.getElementById(c+16).style.backgroundColor = 'lightgrey';
- document.getElementById(c+7).style.backgroundColor = 'lightgrey';
- }
- else if(x<=58){
- document.getElementById(x).innerHTML='♟';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c+8).style.backgroundColor = 'white';
- document.getElementById(c+16).style.backgroundColor = 'lightgrey';
- document.getElementById(c+7).style.backgroundColor = 'lightgrey';
- document.getElementById(c+9).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML='';
- document.getElementById(x).style.backgroundColor = 'red';
- }
- jogada=1;
- verde=0;
- if(x-c==8){
- jogo[x]=3;
- }
- else{
- jogo[x]=4;
- }
- jogo[c]=0;
- }
- else if(jogo[c]==3){
- if((c==9 ||c==17 ||c==25 ||c==33 ||c==41) && x<=58){
- document.getElementById(x).innerHTML='♟';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c+8).style.backgroundColor = 'lightgrey';
- document.getElementById(c+16).style.backgroundColor = 'white';
- document.getElementById(c+9).style.backgroundColor = 'white';
- }
- else if((x==16 || x==24 || x==32 || x==40 || x==48) && x<=58){
- document.getElementById(x).innerHTML='♟';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c+8).style.backgroundColor = 'lightgrey';
- document.getElementById(c+16).style.backgroundColor = 'white';
- document.getElementById(c+7).style.backgroundColor = 'white';
- }
- else if(x<=58){
- document.getElementById(x).innerHTML='♟';
- document.getElementById(c).innerHTML=' ';
- document.getElementById(c+8).style.backgroundColor = 'lightgrey';
- document.getElementById(c+16).style.backgroundColor = 'white';
- document.getElementById(c+7).style.backgroundColor = 'white';
- document.getElementById(c+9).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(x).innerHTML='♙';
- document.getElementById(c).innerHTML='';
- document.getElementById(x).style.backgroundColor = 'red';
- }
- jogada=1;
- verde=0;
- if(x-c==8){
- jogo[x]=4;
- }
- else{
- jogo[x]=3;
- }
- jogo[c]=0;
- }
- }
- if(c==x && jogo[x]==4){
- if(c==9 ||c==17 ||c==25 ||c==33 ||c==41||c==49){
- document.getElementById(x+8).style.backgroundColor = 'white';
- document.getElementById(x+16).style.backgroundColor = 'lightgrey';
- document.getElementById(x+9).style.backgroundColor = 'lightgrey';
- }
- else if(c==16 ||c==24 ||c==32 ||c==40 ||c==48 || c==56){
- document.getElementById(x+8).style.backgroundColor = 'white';
- document.getElementById(x+16).style.backgroundColor = 'lightgrey';
- document.getElementById(x+9).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(x+8).style.backgroundColor = 'white';
- document.getElementById(x+16).style.backgroundColor = 'lightgrey';
- document.getElementById(x+7).style.backgroundColor = 'lightgrey';
- document.getElementById(x+9).style.backgroundColor = 'lightgrey';
- }
- verde=0;
- }
- else if(c==x && jogo[x]==3){
- if(c==9 ||c==17 ||c==25 ||c==33 ||c==41||c==49){
- document.getElementById(x+8).style.backgroundColor = 'lightgrey';
- document.getElementById(x+16).style.backgroundColor = 'white';
- document.getElementById(x+9).style.backgroundColor = 'white';
- }
- else if(c==16 ||c==24 ||c==32 ||c==40 ||c==48 || c==56){
- document.getElementById(x+8).style.backgroundColor = 'lightgrey';
- document.getElementById(x+16).style.backgroundColor = 'white';
- document.getElementById(x+7).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(x+8).style.backgroundColor = 'lightgrey';
- document.getElementById(x+16).style.backgroundColor = 'white';
- document.getElementById(x+7).style.backgroundColor = 'white';
- document.getElementById(x+9).style.backgroundColor = 'white';
- }
- verde=0;
- }
- verifica();
- }
- }
- }
- function verifica(){
- for(i=1;i<=7;i++){
- if(jogo[i]==1 || jogo[i]==2){
- alert('O JOGADADOR COM AS PEÇAS BRANCAS GANHOU! MUITOS PARABÉNS!');
- jogada=0;
- }
- }
- for(i=57;i<=64;i++){
- if(jogo[i]==3 || jogo[i]==4){
- alert('O JOGADADOR COM AS PEÇAS PRETAS GANHOU! MUITOS PARABÉNS!');
- jogada=0;
- }
- }
- }
- function reinicia(){
- for(i=1;i<=64;i++){
- jogo[i]=0;
- document.getElementById(i).innerHTML="";
- }
- for(i=1;i<=64;i++){
- if(i==49 || i==55 || i==51|| i==53){
- jogo[i]=1;
- }
- if(i==50 || i==52 || i==54|| i==56){
- jogo[i]=2;
- }
- if(i==9 || i==11 || i==13|| i==15){
- jogo[i]=3;
- }
- if(i==10 || i==12 || i==14|| i==16){
- jogo[i]=4;
- }
- }
- for(i=9;i<=16;i++){
- document.getElementById(i).innerHTML="♟";
- }
- for(i=49;i<=56;i++){
- document.getElementById(i).innerHTML="♙";
- }
- jogada=1;
- for(i=1;i<=8;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- }
- for(i=9;i<=16;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'white';
- }
- }
- for(i=17;i<=24;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- }
- for(i=25;i<=32;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'white';
- }
- }
- for(i=33;i<=40;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- }
- for(i=41;i<=48;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'white';
- }
- }
- for(i=49;i<=56;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'white';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- }
- for(i=57;i<=64;i++){
- if(i%2==0){
- document.getElementById(i).style.backgroundColor = 'lightgrey';
- }
- else{
- document.getElementById(i).style.backgroundColor = 'white';
- }
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement