I'm trying to limit the amount of checkboxes that someone can choose. I want to be able to compare 2 mortgage payment frequencies. Any two can be chosen of Monthly, Bi-Weekly and Weekly. For some reason I am getting an error.
Can someone please help me?
Here is what I have:
index.htm:
Code:
<script type="text/javascript" language="javascript" src="mortgraph.js"></script>
...
<form>
Compounding:
<select name="comp">
<option value="2" selected>Semi-annual</option>
<option value="12">Monthly</option>
</select><br><br>
Mortgage Amount: <input type="text" name="amt"><br><br>
Interest Rate: <input type="text" name="i"><br><br>
Amortization (years): <input type="text" name="am"><br><br>
Select to compare (max. 2):
<input type="checkbox" name="monthly" checked onclick="alert();"> Monthly
<input type="checkbox" name="biweekly" checked onclick="max2();"> Bi-Weekly
<input type="checkbox" name="weekly" onclick="max2()"> Weekly
</form>
mortgraph.js:
Code:
function max2() {
var numchecked = 0;
var typ = document.getElementByName('weekly');
alert(typ);
if(numchecked > 2) {
alert("I'm sorry, you can only view one or two frquencies at a time.");
return false;
} else {
return true;
}
}
|