Hi, I am trying to display a totalised set of 5 values taken from 5 <cfinput> tags so it shows up in a javascript alert message box. the code worked ok just using
standard html <form> and <input> tags on netscape 4.7 browsers. However IT DONT WORK when i use <cfform> and <cfinput> tags as I get a javascript error. though it seems
to work ok in Internet explorer.
I'm pretty new to javascript so if you can tell me what I'm doing wrong and maybe advise on a better way of doing it, i wud be truly grateful
please see listing below:
Chris
<html>
<head>
<title>Total User Input Using Javascript</title>
<SCRIPT LANGUAGE = "JavaScript">
function pressed(){
var tote1=parseInt(SetActive.qty1.value);
var tote2=parseInt(SetActive.qty2.value);
var tote3=parseInt(SetActive.qty3.value);
var tote4=parseInt(SetActive.qty4.value);
var tote5=parseInt(SetActive.qty5.value);
var tote = tote1+tote2+tote3+tote4+tote5
alert("Total for this fixing ="+tote)
}
</script>
</head>
<body>
<cfFORM name ="SetActive" ACTION="myURL" METHOD="POST">
QTY1<cfINPUT TYPE ="TEXT" NAME = "qty1" value = "0"><br>
QTY2<cfINPUT TYPE ="TEXT" NAME = "qty2" value = "0"><br>
QTY3<cfINPUT TYPE ="TEXT" NAME = "qty3" value = "0"><br>
QTY4<cfINPUT TYPE ="TEXT" NAME = "qty4" value = "0"><br>
QTY5<cfINPUT TYPE ="TEXT" NAME = "qty5" value = "0">
<input type ="button" name="totebutton" value = "check totals" onClick="pressed()">
</cfform>
</body>
</html>
standard html <form> and <input> tags on netscape 4.7 browsers. However IT DONT WORK when i use <cfform> and <cfinput> tags as I get a javascript error. though it seems
to work ok in Internet explorer.
I'm pretty new to javascript so if you can tell me what I'm doing wrong and maybe advise on a better way of doing it, i wud be truly grateful
please see listing below:
Chris
<html>
<head>
<title>Total User Input Using Javascript</title>
<SCRIPT LANGUAGE = "JavaScript">
function pressed(){
var tote1=parseInt(SetActive.qty1.value);
var tote2=parseInt(SetActive.qty2.value);
var tote3=parseInt(SetActive.qty3.value);
var tote4=parseInt(SetActive.qty4.value);
var tote5=parseInt(SetActive.qty5.value);
var tote = tote1+tote2+tote3+tote4+tote5
alert("Total for this fixing ="+tote)
}
</script>
</head>
<body>
<cfFORM name ="SetActive" ACTION="myURL" METHOD="POST">
QTY1<cfINPUT TYPE ="TEXT" NAME = "qty1" value = "0"><br>
QTY2<cfINPUT TYPE ="TEXT" NAME = "qty2" value = "0"><br>
QTY3<cfINPUT TYPE ="TEXT" NAME = "qty3" value = "0"><br>
QTY4<cfINPUT TYPE ="TEXT" NAME = "qty4" value = "0"><br>
QTY5<cfINPUT TYPE ="TEXT" NAME = "qty5" value = "0">
<input type ="button" name="totebutton" value = "check totals" onClick="pressed()">
</cfform>
</body>
</html>