Hi & Good Morning
Thanks for the reply and I do apologise in delayed answering my company
had
me all over the place yesterday and this morning I have over a 100 mile
commute.
I set up a new page and got all of your reply working then I had a go at
changing it to fit my requirements still OK until I wanted to Add the
values
of the two textboxes
T16 / T17 instead of adding them it is multiplying them together and a
couple of early morning hours trying has not helped at all.
<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
if (!isNaN(df.T13.value)) { //check that a numeric value is entered
if (!isNaN(df.T15.value)) {
if (!isNaN(df.T16.value)) {
if (!isNaN(df.T17.value)) {
if (!isNaN(df.T18.value)) {
df.T16.value = df.T12.value * df.T14.value;
df.T17.value = df.T13.value * df.T15.value;
df.T18.value = df.T16.value + df.T17.value;
return;
}}}}}}}
df.T16.value = "Numeric values required"; //error message
df.T17.value = "Numeric values required"; //error message
df.T18.value = "Numeric values required"; //error message
}
</script>
<input name="T14" type="text" size="6"><br />
<input name="T12"value=" 7.00" type="text" size="6"><br />
<input name="T13" type="text" size="6"><br />
<input name="T15"value=" 3.50" type="text" size="6"><br />
<br />
<input name="T16" type="text" size="6">
</p>
<input name="T17" type="text" size="6"></p>
<input name="T18" type="text" size="6"><p>
<input type="button" value="Add / Multiply" onclick="calculate()"></p>
<p>
</p>
</form>
</body>
</html>
--
Many Thanks
Ronx said:
I am assuming that T12, T14 and T16 are text boxes that are not included
in
your code snippet. Also assuming that the form is the first form on the
page in Code view. If this is the case then:
<body>
<form>
<script type="text/javascript">
function calculate() {
var df = document.forms[0]
if (!isNaN(df.T12.value)) { //check that a numeric value is entered
if (!isNaN(df.T14.value)) {
df.T16.value = df.T12.value * df.T14.value;
return;
}}
df.T16.value = "Numeric values required"; //error message
}
</script>
<input name="T14" type="text"><br />
<input name="T12" type="text"><br />
<input type="button" value="=" onclick="calculate()"> <br />
<input name="T16" type="text">
</form>
</body>
The above makes a lot of assumptions which may not be accurate - I have
no
idea what your code is supposed to do since the onClick function makes no
sense to me, and the relevant form fields are missing.
--
Ron Symonds
Microsoft MVP (Expression Web)
http://www.rxs-enterprises.org/fp
Reply only to group - emails will be deleted unread.
Hi
First post here wonder if you can help with the problem on this form
<FORM>
<INPUT TYPE="BUTTON" VALUE="=" onClick="form.T16.value =
((((form.T16.value = form.T12 * form.T14(form.T16.value)))))">
<INPUT TYPE="TEXT" NAME="Total Value">
</FORM>
On Click T16 displays NaN -- Lost it here I'm afraid -- Help