|
-
Jul 22nd, 2003, 04:26 AM
#1
Thread Starter
Fanatic Member
Add 2 fields
I know this is going to sound daft but I aint a javascript man.
I have 3 fields on a form f1, f2 and f3.
When the user leaves f1 or f2 I need to first check to see if it is a
numeric type then add f1 and f2 together and place the answer in the f3
field.
Can anyone help ?
-
Jul 22nd, 2003, 07:44 AM
#2
Thread Starter
Fanatic Member
Actually its three fields.
e.g
function sum_it(textbox) {
if ((textbox.value.indexOf('0') == -1) && (textbox.value.indexOf("1") == -1) &&
(textbox.value.indexOf("2") == -1) && (textbox.value.indexOf("3") == -1) &&
(textbox.value.indexOf("4") == -1) && (textbox.value.indexOf("5") == -1) &&
(textbox.value.indexOf("6") == -1) && (textbox.value.indexOf("7") == -1) &&
(textbox.value.indexOf("8") == -1) && (textbox.value.indexOf("9") == -1) ) {
alert("You must enter only numbers");
return;
}
var tot1 = (parseInt(document.form1.txtProceeds.value)) + (parseInt(document.form1.txtCashProvided.value));
var tot2 = tot1 + (parseInt(document.form1.txtPurchasePrice.value));
document.form1.txtBalance.value = tot2.toString();
}
I am sick of this. Im gonna go and catch Malaria just for the hell of it.
-
Jul 22nd, 2003, 10:43 AM
#3
-
Jul 22nd, 2003, 10:54 AM
#4
Thread Starter
Fanatic Member
Forth with oh green slimy one.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|