Moved code into function
This commit is contained in:
parent
2e0bc3764f
commit
07a34b1b12
|
@ -29,6 +29,14 @@ function checkCount() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check(choice) {
|
||||||
|
value = checkedGroups[0];
|
||||||
|
removeId();
|
||||||
|
getid = choice+value;
|
||||||
|
document.getElementById(getid).checked = true;
|
||||||
|
checkCount();
|
||||||
|
}
|
||||||
|
|
||||||
window.addEventListener("keydown", function (event) {
|
window.addEventListener("keydown", function (event) {
|
||||||
if (event.defaultPrevented) {
|
if (event.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
|
@ -40,18 +48,10 @@ window.addEventListener("keydown", function (event) {
|
||||||
|
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "a":
|
case "a":
|
||||||
value = checkedGroups[0];
|
check("a");
|
||||||
removeId();
|
|
||||||
getid = 'a'+value;
|
|
||||||
document.getElementById(getid).checked = true;
|
|
||||||
checkCount();
|
|
||||||
break;
|
break;
|
||||||
case "b":
|
case "b":
|
||||||
value = checkedGroups[0];
|
check("b");
|
||||||
removeId();
|
|
||||||
getid = 'b'+value;
|
|
||||||
document.getElementById(getid).checked = true;
|
|
||||||
checkCount();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
checkCount();
|
checkCount();
|
||||||
|
|
Loading…
Reference in New Issue