Change to:
<script language="JavaScript"><!--
function Morgcal()
{
var form = document.forms.myform;
var sum1 = form.num1.value;
var sum2 = form.num2.value;
var sum3 = form.num3.value;
var sum4 = form.num4.value;
var sum = 0; //this is never used?
var ctotal = sum1;
ctotal = ctotal+sum2;
ctotal = ctotal+sum3;
ctotal = ctotal+sum4;
form.total.value = Math.floor(ctotal);
}
Could be shortened to:
var form = document.forms.myform;
var sum1 = form.num1.value + form.num2.value + form.num3.value +
form.num4.value;
form.total.value = Math.floor(sum1);
Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
-----Original Message-----
From: java script help needed [mailto:thank you for your help]
Posted At: 25. juli 2004 17:58
Posted To: microsoft.public.frontpage.programming
Conversation: saving scripts
Subject: Re: saving scripts
i am having trouble with adding numbers in java, i have the following
java script that is not working correctly, any ideas how to get it to
work right, i know there is a simple answer but i have been trying for
days to get it to work.
<script language="JavaScript"><!--
function Morgcal()
{
form = document.myform
sum1= form.num1.value
sum2= form.num2.value
sum3= form.num3.value
sum4= form.num4.value
sum=0
ctotal=(sum1)
ctotal=ctotal+(sum2)
ctotal=ctotal+(sum3)
ctotal=ctotal+(sum4)
form.total.value=Math.floor(ctotal)
}
// --></script>
thanks
Steve Easton said:
Call it from the head section of the page using:
<script type=text/javascript src="name.js"> </script>
--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer
"thank you" <thanks again> wrote in message news:%
[email protected]...