<html>
<head><title>Tic Tac Toe</title>
<script>
//function on click per 2 per il td 2
function createX2() {
var td2 = document.getElementById('td2');
};
};
//function onclick per il td 3
function createX3() {
var td3 = document.getElementById('td3');
if (td3 == 'X' || td3 == 'O') {
alert('Non puoi inserire la tua mossa qui,è già occupato');
} else if ( td3 != 'X' || td3 != 'O') {
document.getElementById('td3').innerHTML = '<div id="td3s"> X </div>';
};
};
//function onclick per il td 4
function createX4() {
var td4 = document.getElementById('td4');
if (td4 == 'X' || td4 == 'O') {
alert('Non puoi inserire la tua mossa qui,è già occupato');
} else if ( td4 != 'X' || td4 != 'O') {
document.getElementById('td4').innerHTML = '<div id="td4s"> X </div>';
};
};
//function onclick per il td 5
function createX5() {
var td5 = document.getElementById('td5');
if (td5 == 'X' || td5 == 'O') {
alert('Non puoi inserire la tua mossa qui,è già occupato');
} else if ( td5 != 'X' || td5 != 'O') {
document.getElementById('td5').innerHTML = '<div id="td5s"> X </div>';
};
};
//function on click per il td 6
function createX6() {
var td6 = document.getElementById('td6');
if (td6 == 'X' || td6 == 'O') {
alert('Non puoi inserire la tua mossa qui,è già occupato');
} else if ( td6 != 'X' || td6 != 'O') {
document.getElementById('td6').innerHTML = '<div id="td6s"> X </div>';
};
};
//function onclick per il td 7
function createX7() {
var td7 = document.getElementById('td7');
if (td7 == 'X' || td7 == 'O') {
alert('Non puoi inserire la tua mossa qui,è già occupato');
} else if ( td7 != 'X' || td7 != 'O') {
document.getElementById('td7').innerHTML = '<div id="td7s"> X </div>';
};
};
//function onclick per il td 8
function createX8() {
var td8 = document.getElementById('td8');
if (td8 == 'X' || td8 == 'O') {
alert('Non puoi inserire la tua mossa qui,è già occupato');
} else if ( td8 != 'X' || td8 != 'O') {
document.getElementById('td8').innerHTML = '<div id="td8s"> X </div>';
};
};
//function onclick per il td 9
function createX9() {
var td9 = document.getElementById('td9');
if (td9 == 'X' || td9 == 'O') {
alert('Non puoi inserire la tua mossa qui,è già occupato');
} else if ( td9 != 'X' || td9 != 'O') {
document.getElementById('td9').innerHTML = '<div id="td9s"> X </div>';
};
};
function createX1() {
var td1 = document.getElementById('td1');
document.getElementById('td1').innerHTML = '<div id="td1s"> X </div>';
};
</script>
</head>
<body>
<style>
#lver1 {
width:5px;
height:180px;
background-color:black;
position:absolute;
top:150px;
left:290px;
}
#lver2 {
width:5px;
height:180px;
background-color:black;
position:absolute;
top:150px;
left:350px;
}
#lor1{
width:180px;
height:5px;
background-color:black;
position:absolute;
top:210px;
left:230px;
}
#lor2{
width:180px;
height:5px;
background-color:black;
position:absolute;
left:230px;
top:270px;
}
#td1s {
position:absolute;
color:black;
font-size:200%;
}
</style>
<div id='lor1'></div>
<div id='lor2'></div>
<div id='lver1'></div>
<div id ='lver2'></div>
<table>
<tr>
<tbody>
<td onclick='createX8()' id ='td8' width='60px' height='60px' style='position:absolute; left:290px; top:270px;'> </td>
<td onclick='createX1()' id ='td1' width='60px' height='60px' style='position:absolute; left:290px; top:210px;'></button></td>
<td onclick='createX3()' id ='td3' width='60px' height='60px' style='position:absolute; left:290px; top:150px;'> </td>
<td onclick='createX7()' id ='td7' width='60px' height='60px' style='position:absolute; left:230px; top:270px;'> </td>
<td onclick='createX9()' id ='td9' width='60px' height='60px' style='position:absolute; left:350px; top:270px;'> </td>
<td onclick='createX5()' id ='td5' width='60px' height='60px' style='position:absolute; left:230px; top:210px;'> </td>
<td onclick='createX6()' id ='td6' width='60px' height='60px' style='position:absolute; left:350px; top:210px;'> </td>
<td onclick='createX2()' id ='td2' width='60px' height='60px' style='position:absolute; left:230px; top:150px;'> </td>
<td onclick='createX4()' id ='td4' width='60px' height='60px' style='position:absolute; left:350px; top:150px;'> </td>
</tbody>
</tr>
</table>
<table id="cacca" style="position:absolute; left:900px; top:200px;"><tr><tbody><td></td></tbody></tr></tbody>
</body>
</html>