M
MickG
Hi,
Im trying to add 3 numbers together, instead of getting 1+2+3=6, I'm
getting 123, how could I remedy this.
ManyThanks in advance
Michael
<html>
<head>
<title>Summation Template File</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript">
function addUp() {
var a,b,c,sum;
a = document.fred.aaa.value; // extract the string of text typed into
the input box
b = document.fred.bbb.value;
c = document.fred.ccc.value;
// the problem is on the next line, all the other lines are OK and
shouldn't be changed
sum =a+b+c ;
window.alert("The sum is "+sum);
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="fred">
<input type="text" name="aaa" size="5">
<input type="text" name="bbb" size="5">
<input type="text" name="ccc" size="5">
<input type="button" value="Sum Data" onClick="addUp();">
</form>
</body>
</html>
Im trying to add 3 numbers together, instead of getting 1+2+3=6, I'm
getting 123, how could I remedy this.
ManyThanks in advance
Michael
<html>
<head>
<title>Summation Template File</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script language="JavaScript">
function addUp() {
var a,b,c,sum;
a = document.fred.aaa.value; // extract the string of text typed into
the input box
b = document.fred.bbb.value;
c = document.fred.ccc.value;
// the problem is on the next line, all the other lines are OK and
shouldn't be changed
sum =a+b+c ;
window.alert("The sum is "+sum);
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="fred">
<input type="text" name="aaa" size="5">
<input type="text" name="bbb" size="5">
<input type="text" name="ccc" size="5">
<input type="button" value="Sum Data" onClick="addUp();">
</form>
</body>
</html>