Last active
May 21, 2022 16:06
-
-
Save yoh2/45299fce3172e53b9ffc34600b6059d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
function onChangeCheck(c, cls) { | |
const found = document.getElementsByClassName(cls); | |
for (const elem of found) { | |
if (c.checked) { | |
elem.classList.add('highlighted'); | |
} else { | |
elem.classList.remove('highlighted'); | |
} | |
} | |
} | |
</script> | |
<style> | |
#board td { | |
width: 1em; | |
text-align: center; | |
font-weight: bold; | |
} | |
.start, .goal { | |
color: red; | |
background-color: #AAF; | |
} | |
.highlighted { | |
background-color: #AAF; | |
} | |
.start::before { | |
content: "S"; | |
} | |
.goal::before { | |
content: "G"; | |
} | |
.one::before { | |
content: "1"; | |
} | |
.two::before { | |
content: "2"; | |
} | |
.three::before { | |
content: "3"; | |
} | |
.four::before { | |
content: "4"; | |
} | |
.five::before { | |
content: "5"; | |
} | |
.six::before { | |
content: "6"; | |
} | |
</style> | |
</head> | |
<body> | |
<p> | |
<label><input type="checkbox" onchange="onChangeCheck(this, 'one');">1</label> | |
<label><input type="checkbox" onchange="onChangeCheck(this, 'two');">2</label> | |
<label><input type="checkbox" onchange="onChangeCheck(this, 'three');">3</label> | |
<label><input type="checkbox" onchange="onChangeCheck(this, 'four');">4</label> | |
<label><input type="checkbox" onchange="onChangeCheck(this, 'five');">5</label> | |
<label><input type="checkbox" onchange="onChangeCheck(this, 'six');">6</label> | |
</p> | |
<table id="board"> | |
<tbody> | |
<tr> | |
<td class="three"></td> | |
<td class="six"></td> | |
<td class="one"></td> | |
<td class="start"></td> | |
<td class="one"></td> | |
<td class="five"></td> | |
<td class="two"></td> | |
</tr> | |
<tr> | |
<td class="two"></td> | |
<td class="five"></td> | |
<td class="four"></td> | |
<td class="two"></td> | |
<td class="one"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
</tr> | |
<tr> | |
<td class="four"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
<td class="six"></td> | |
<td class="one"></td> | |
</tr> | |
<tr> | |
<td class="five"></td> | |
<td class="two"></td> | |
<td class="four"></td> | |
<td class="four"></td> | |
<td class="four"></td> | |
<td class="six"></td> | |
<td class="five"></td> | |
</tr> | |
<tr> | |
<td class="six"></td> | |
<td class="four"></td> | |
<td class="one"></td> | |
<td class="five"></td> | |
<td class="three"></td> | |
<td class="four"></td> | |
<td class="six"></td> | |
</tr> | |
<tr> | |
<td class="one"></td> | |
<td class="four"></td> | |
<td class="six"></td> | |
<td class="goal"></td> | |
<td class="six"></td> | |
<td class="four"></td> | |
<td class="three"></td> | |
</tr> | |
</tbody> | |
</table> | |
<body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<style> | |
#board td { | |
width: 1em; | |
text-align: center; | |
font-weight: bold; | |
} | |
.start, .goal { | |
color: red; | |
background-color: #AAF; | |
} | |
#one-check:checked ~ table .one, | |
#two-check:checked ~ table .two, | |
#three-check:checked ~ table .three, | |
#four-check:checked ~ table .four, | |
#five-check:checked ~ table .five, | |
#six-check:checked ~ table .six { | |
background-color: #AAF; | |
} | |
.start::before { | |
content: "S"; | |
} | |
.goal::before { | |
content: "G"; | |
} | |
.one::before { | |
content: "1"; | |
} | |
.two::before { | |
content: "2"; | |
} | |
.three::before { | |
content: "3"; | |
} | |
.four::before { | |
content: "4"; | |
} | |
.five::before { | |
content: "5"; | |
} | |
.six::before { | |
content: "6"; | |
} | |
</style> | |
</head> | |
<body> | |
<input id="one-check" type="checkbox"><label for="one-check">1</label> | |
<input id="two-check" type="checkbox"><label for="two-check">2</label> | |
<input id="three-check" type="checkbox"><label for="three-check">3</label> | |
<input id="four-check" type="checkbox"><label for="four-check">4</label> | |
<input id="five-check" type="checkbox"><label for="five-check">5</label> | |
<input id="six-check" type="checkbox"><label for="six-check">6</label> | |
<table id="board"> | |
<tbody> | |
<tr> | |
<td class="three"></td> | |
<td class="six"></td> | |
<td class="one"></td> | |
<td class="start"></td> | |
<td class="one"></td> | |
<td class="five"></td> | |
<td class="two"></td> | |
</tr> | |
<tr> | |
<td class="two"></td> | |
<td class="five"></td> | |
<td class="four"></td> | |
<td class="two"></td> | |
<td class="one"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
</tr> | |
<tr> | |
<td class="four"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
<td class="three"></td> | |
<td class="six"></td> | |
<td class="one"></td> | |
</tr> | |
<tr> | |
<td class="five"></td> | |
<td class="two"></td> | |
<td class="four"></td> | |
<td class="four"></td> | |
<td class="four"></td> | |
<td class="six"></td> | |
<td class="five"></td> | |
</tr> | |
<tr> | |
<td class="six"></td> | |
<td class="four"></td> | |
<td class="one"></td> | |
<td class="five"></td> | |
<td class="three"></td> | |
<td class="four"></td> | |
<td class="six"></td> | |
</tr> | |
<tr> | |
<td class="one"></td> | |
<td class="four"></td> | |
<td class="six"></td> | |
<td class="goal"></td> | |
<td class="six"></td> | |
<td class="four"></td> | |
<td class="three"></td> | |
</tr> | |
</tbody> | |
</table> | |
<body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment