Good evening! I have the following page:
<html> <head> <title>крестики нолики</title> <script type="text/javascript" language="javascript"> function ShowImage(id) { if(document.getElementById("flag").title == "false") { document.getElementById(id).src="1.png"; document.getElementById("flag").title = "true"; }else { document.getElementById(id).src="2.png"; document.getElementById("flag").title = "false"; } } function CreateTable(size) { //Создание таблицы } </script> <style type='text/css'> td{ border: 2px solid #000000; padding: 2px; } table{ margin: 0 auto; width: 200px; max-width: 900px; min-width: 50px; height: 200px; max-height: 1200px; min-height: 100px; </style> </head> <body> <FORM <b>Введите размер таблицы.</b> <BR> <INPUT TYPE=Text NAME="Info"> <INPUT TYPE=BUTTON ONCLICK="CreateTable(4)" VALUE="Создать"> </FORM> <div id="flag" title = "false"></div> <table> <tr> <td/><img id="i1" onClick="ShowImage(this.id)" src="0.png"></td> <td/><img id="i2" onClick="ShowImage(this.id)" src="0.png"></td> <td/><img id="i3" onClick="ShowImage(this.id)" src="0.png"></td> </tr> <tr> <td/><img id="i4" onClick="ShowImage(this.id)" src="0.png"></td> <td/><img id="i5" onClick="ShowImage(this.id)" src="0.png"></td> <td/><img id="i6" onClick="ShowImage(this.id)" src="0.png"></td> </tr> <tr> <td/><img id="i7" onClick="ShowImage(this.id)" src="0.png"></td> <td/><img id="i8" onClick="ShowImage(this.id)" src="0.png"></td> <td/><img id="i9" onClick="ShowImage(this.id)" src="0.png"></td> </tr> </table> </body> </html> There is a table on it, by clicking on the cells of which you can change the picture to a cross or a toe.
How to make the same table, with the same functionality, but with the size specified by the user?
Using only js and html.