Added a listener so you can now hit 'enter' or 'return' on the keyboard to do the calculation

This commit is contained in:
Taylor Courage 2024-07-03 00:07:17 -04:00
parent cc43efdd48
commit 9e381477e2

View File

@ -13,7 +13,7 @@
<h1>Machine 11 Die Calculator</h1>
<p>Use this calculator to create setups for machine 11</p>
</div>
<div class="body">
<div class="body" id="body">
<input autocomplete="off" id="startSize" type="text" value="5.5" size="4" />
<label for="startSize"> - Start size</label>
<input type="radio" name="units" id="metric" value="mm" checked />
@ -22,7 +22,7 @@
<label for="inches">in</label>
<br />
<input autocomplete="off" id="finalSize" type="text" value=".000" size="4" />
<label for="finishSize"> - Final size</label>
<label for="finalSize"> - Final size</label>
<br />
<input autocomplete="off" id="coilerTarget" type="text" value="10" size="1" />
<label for="coilerTarget">% - Coiler Target ROA</label>
@ -30,9 +30,18 @@
<input autocomplete="off" id="machineMaxReduction" type="text" value="20" size="1" />
<label for="machineMaxReduction">% - Machine Max ROA</label>
<br />
<input type="button" value="Create Setup" onclick="getDies()" />
<input type="button" value="Create Setup" onclick="getDies()" id="submitButton" />
<input type="button" value="Clear" onclick="clearScreen()" />
<br />
<script>
var input = document.getElementById("body");
input.addEventListener("keypress", function (event) {
if (event.key === "Enter") {
event.preventDefault();
document.getElementById("submitButton").click();
}
});
</script>
&nbsp;
<br />
<table class="dieSetup">