Základ pro piškvorky, kód od Aleše - děkuji.
<!DOCTYPE HTML SYSTEM> <html> <head> <style> table {border-collapse:collapse} td { border:2px solid black; padding:10px; } </style> <title> Piškvorky </title> </head> Piškvorky <br> <br> <body> <table> <tr> <td id="bunka1_1"></td> <td id="bunka1_2"></td> <td id="bunka1_3"></td> </tr> <tr> <td id="bunka2_1"></td> <td id="bunka2_2"></td> <td id="bunka2_3"></td> </tr> <tr> <td id="bunka3_1"></td> <td id="bunka3_2"></td> <td id="bunka3_3"></td> </tr> </table> <script>
var naTahu="X"; function kliknuto(){ // this.style.backgroundColor="green"; this.innerHTML=naTahu; if(naTahu=="X"){ naTahu="O"; }else if(naTahu=="O"){ naTahu="X"; } } //1.Řada document.getElementById("bunka1_1").onclick = kliknuto; document.getElementById("bunka1_2").onclick = kliknuto; document.getElementById("bunka1_3").onclick = kliknuto; //2.Řada document.getElementById("bunka2_1").onclick = kliknuto; document.getElementById("bunka2_2").onclick = kliknuto; document.getElementById("bunka2_3").onclick = kliknuto; //3. Řada document.getElementById("bunka3_1").onclick = kliknuto; document.getElementById("bunka3_2").onclick = kliknuto; document.getElementById("bunka3_3").onclick = kliknuto;
</script> </body> </html>