I made this code a while ago and had all text input. Now I am coming back through and adding drop downs to redundant values. The problem is when I add the selection list the wireSize function no longer sends the size to the inputbox on the html. I can't figure out the problem.
Here is the JS
And the html:
Any help is appreciated
Here is the JS
Code:
function wireSize(){
var amps =(document.getElementById("resultbox4").value);
var wire = document.wireNum.wire.value;
if (amps <= 20) && (wire == 3) {
size = "3-#12 + #12grd in 3/4\" C";
var result = document.getElementById("wireSize");
result.value = size;
}
else
if (amps <= 20) && (wire == 4) {
size = "4-#10 + #10grd in 3/4\" C";
var result = document.getElementById("wireSize");
result.value = size;
}
else
if (amps > 20 && amps <= 30) && (wire == 3) {
size = "3-#10 + #10grd in 3/4\" C";
var result = document.getElementById("wireSize");
result.value = size;
}
else
if (amps > 20 && amps <= 30) && (wire == 4) {
size = "4-#10 + #10grd in 3/4\" C";
var result = document.getElementById("wireSize");
result.value = size;
}}
Code:
<h2>Wire size and 80%</h2> <form name = "wireNum"> <input type="text" name="myresultbox" id="resultbox4" style="width:50px; height:16.775px;"> Amps<br> <select name="wire"> <option value=3>3W</option> <option value=4>4W</option> </select><br> <input value="Click for 80%" onclick="percentAmps()" type="button"> <input type="text" name="myresultbox" id="ampPerc" style="width:50px; height:16.775px;"> Amps<br> <input value="Click for Wire Size" onclick="wireSize()" type="button"> <input type="text" name="myresultbox" id="wireSize" style="width:200px; height:16.775px;"> <br> <form>
Comment