Sue Moe Re: [OT] Need more JavaScript help (Please disregard previous)
Apr 16, 2002; 11:32
Sue Moe
Re: [OT] Need more JavaScript help (Please disregard previous)
Ok, now I have the calculate function working, but I keep getting the "Sorry, your total is invalid!" response, even when I hit the required 100%. Help?
Thanks,
Sue
¯---------------------------------------------- <html> <head> <title>Testing the JavaScript Calculator</title> <script language = "JavaScript"> <!-- hide me
function sumTheFields() { var number_one = window.document.the_form.field_one.value; var number_two = window.document.the_form.field_two.value; var sum = number_one + number_two;
var sum = Number(number_one) + Number(number_two);
window.document.the_form.total.value = sum;
if (sum!=100) return false else return true; //// note, if they are entering .5 and .5, then change 100 to 1.
}
function checkTotal(total) { if (parseInt(total) == 100) { alert("looks good to me!"); return true; } else { alert("sorry, your total is invalid!"); return false; } } ////end hiding commend --> </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head>
<body bgcolor="#FFFFFF" text="#000000"> <form name = "the_form" onSubmit="return checkTotal(total)"> <p>Category 1: <input type = "text" name = "field_one" size="5" maxlength="3"> % <br> Category 2: <input type = "text" name = "field_two" size="5" maxlength="3"> % <br> Total Percentage: <input type = "text" name = "total" size="5" maxlength="3"> %<br> <a href="#" onClick = "sumTheFields(); return false;">Calculate</a> </p> <p> <input type="submit" name="Submit" value="Submit"> </p> </form> </body> </html>
------------------------------------------------------------------------ List Administrator: <mailto:dreamweaver-admin@blueworld.com> To Unsubscribe: <mailto:dreamweaver-off@blueworld.com> Archives: <http:////listsearch.blueworld.com/dreamweavertalksearch.lasso>
Apr 16
Paul Davis Re: [OT] Need more JavaScript help (Please disregard previous)
Apr 16, 2002; 11:55
Paul Davis
Re: [OT] Need more JavaScript help (Please disregard previous)
Apr 16
Jordan L. Chilcott (Dreamweaver List Admin) Re: [OT] Need more JavaScript help (Please disregard previous)
Apr 16, 2002; 17:05
Jordan L. Chilcott (Dreamweaver List Admin)
Re: [OT] Need more JavaScript help (Please disregard previous)
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!