does javascript permit it?

This commit is contained in:
Gnieark 2015-12-11 12:35:34 +01:00
parent 82790c37d0
commit 9252427740
2 changed files with 5 additions and 2 deletions

View File

@ -20,7 +20,7 @@ function createElem(type,attributes)
return elem;
}
function battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShip4,nbShip5,nbShip6,xd_check){
function battleship(botsArray,bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShip4,nbShip5,nbShip6,xd_check){
document.getElementById('fightResult').innerHTML = '';
//dessiner les deux grilles
@ -28,6 +28,9 @@ function battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShi
tableMe=createElem("table",{"id":"tblAdv","class":"battleshipGrid"});
for (i=0; i < gridHeight ; i++){
//ligne de titre
trAdv=createElem("tr");
trMe=createElem("tr");
for (j=0; j < gridWidth ; j++){

View File

@ -49,6 +49,6 @@ if(!$postParams){
</select></em>
</p>
<!-- battleship(bot1,bot2,gridWidth,gridHeight,nbShip1,nbShip2,nbShip3,nbShip4,nbShip5,nbShip6,xd_check) -->
<p><label>&nbsp;</label><input type="button" value="<?php echo $lang['FIGHT']; ?>" onclick="battleship(document.getElementById('bot1').value,document.getElementById('bot2').value,getElementById('width').value,getElementById('height').value,getElementById('ship1').value,getElementById('ship2').value,getElementById('ship3').value,getElementById('ship4').value,getElementById('ship5').value,getElementById('ship6').value,'<?php echo xd_check_input(2); ?>');"></p>
<p><label>&nbsp;</label><input type="button" value="<?php echo $lang['FIGHT']; ?>" onclick="battleship(<?php echo json_encode($bots); ?>,document.getElementById('bot1').value,document.getElementById('bot2').value,getElementById('width').value,getElementById('height').value,getElementById('ship1').value,getElementById('ship2').value,getElementById('ship3').value,getElementById('ship4').value,getElementById('ship5').value,getElementById('ship6').value,'<?php echo xd_check_input(2); ?>');"></p>
<div id="fightResult"></div>
</article>