change tables id
This commit is contained in:
parent
0ef926479d
commit
ac590f6314
|
@ -25,8 +25,8 @@ function battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShi
|
|||
var bot2IdName = bot2.split("-");
|
||||
document.getElementById('fightResult').innerHTML = '';
|
||||
//dessiner les deux grilles
|
||||
var tableAdv=createElem("table",{"id":"tblAdv","class":"battleshipGrid"});
|
||||
var tableMe=createElem("table",{"id":"tblAdv","class":"battleshipGrid"});
|
||||
var tableAdv=createElem("table",{"id":"tbl1","class":"battleshipGrid"});
|
||||
var tableMe=createElem("table",{"id":"tbl2","class":"battleshipGrid"});
|
||||
//ligne de titre
|
||||
var trTitre1=createElem("tr");
|
||||
var trTitre2=createElem("tr");
|
||||
|
@ -43,8 +43,8 @@ function battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShi
|
|||
var trAdv=createElem("tr");
|
||||
var trMe=createElem("tr");
|
||||
for (var j=0; j < gridWidth ; j++){
|
||||
var tdAdv=createElem("td",{"id":"adv" + i +"-" + j,"class": "empty"});
|
||||
var tdMe=createElem("td",{"id":"me" + i +"-" + j,"class": "empty"});
|
||||
var tdAdv=createElem("td",{"id":"bot1-" + i +"-" + j,"class": "empty"});
|
||||
var tdMe=createElem("td",{"id":"bot2-" + i +"-" + j,"class": "empty"});
|
||||
trAdv.appendChild(tdAdv);
|
||||
trMe.appendChild(tdMe);
|
||||
}
|
||||
|
@ -63,7 +63,18 @@ function battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShi
|
|||
if(xhr.status == 200) {
|
||||
//debug
|
||||
//alert(xhr.responseText);
|
||||
document.getElementById('logs').innerHTML = xhr.responseText;
|
||||
try{
|
||||
var boats = JSON.parse(this.responseText);
|
||||
//for
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
catch(e){
|
||||
document.getElementById('logs').innerHTML = xhr.responseText;
|
||||
|
||||
}
|
||||
}
|
||||
}};
|
||||
xhr.open("POST", '/Battleship', true);
|
||||
|
|
Loading…
Reference in New Issue
Block a user