draw table

This commit is contained in:
gnieark 2016-05-12 19:45:15 +02:00
parent 085e89a032
commit 93a424369b

View File

@ -12,8 +12,28 @@ function Ajx(){
}
return request;
}
function createElem(type,attributes){
var elem=document.createElement(type);
for (var i in attributes)
{elem.setAttribute(i,attributes[i]);}
return elem;
}
function connectFour(bot1,bot2,xd_check){
document.getElementById('fightResult').innerHTML = '<p>Please wait...</p>';
document.getElementById('fightResult').innerHTML = '';
//create grid
var table=createElem('table',{'className':'tabledoc'});
for (var i=0; i<6; i++){
var tr=createElem('tr');
for (var j=0;j<7: j++){
var td=createElem('td',{'id': 'td' + i + '-' + j});
tr.appendChild (td);
}
table.appendChild(tr);
}
document.getElementById('fightResult').appendChild(table);
var xhr = Ajx();
xhr.onreadystatechange = function(){if(xhr.readyState == 4){
if(xhr.status == 200) {
@ -23,7 +43,11 @@ function connectFour(bot1,bot2,xd_check){
document.getElementById('logs').innerHTML += 'erreur' +xhr.responseText;
return;
}
alert (reponse['continue']);
alert (reponse['continue']);
}else{
alert ('error ' + xhr.status);
return;