delinear
05-04-2005, 11:32 AM
I have to put together some calculators for an accountancy project but I'm having a problem passing a form name to a function and then using that to access the values of the form's elements. Here's how I'm trying to do this, it works in IE but not in FireFox, anyone know why or how I can do this?
<script language="javascript">
function alertme(lv) {
alert(document.getElementById(lv).field_loan.value);
}
</script>
<form name="calc_loan" method="post" action="">
<input name="field_loan" type="text" id="field_loan" value="">
<input type="submit" name="Submit" value="Submit" onClick="alertme(this.form.name); return false;">
</form>
<script language="javascript">
function alertme(lv) {
alert(document.getElementById(lv).field_loan.value);
}
</script>
<form name="calc_loan" method="post" action="">
<input name="field_loan" type="text" id="field_loan" value="">
<input type="submit" name="Submit" value="Submit" onClick="alertme(this.form.name); return false;">
</form>