changed code -> sets .selected for all fields to 0

changed index -> script now gets loaded at the end of the body
master
ElGurkus 4 years ago
parent 120bdb430c
commit 1885fcc517

@ -1,3 +1,9 @@
let fieldId = 0;
for(let i = 0; i < 64; i++){
fieldId = i.toString();
document.getElementById("field"+fieldId).selected = 0;
}
function selectField(field){ function selectField(field){
console.log(field.id); console.log(field.id);
field.style.backgroundColor = "rgb(227,8,8, 0.3)";
} }

@ -4,7 +4,6 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Title</title> <title>Title</title>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<script src="code.js"></script>
</head> </head>
<body> <body>
<ul> <ul>
@ -95,5 +94,6 @@
<td id="field63" class="game fields" onclick="selectField(this)"></td> <td id="field63" class="game fields" onclick="selectField(this)"></td>
</tr> </tr>
</table> </table>
<script src="code.js"></script>
</body> </body>
</html> </html>
Loading…
Cancel
Save