Question
Onclick display result in textbox
Could anybody please help me with simple multiply code in
coldfusion. I am trying to multiply price * quantity and get result
total onclick Textfield. Below is the code I am using, but is not
working:
<SCRIPT language="JavaScript">
function checkValue(thisTxt, tbox1Id, tbox2Id)
<!--
{
var txt1Obj = document.getElementById(tbox1Id);
var txt2Obj = document.getElementById(tbox2Id);
thisTxt.value = txt1Obj.value * txt2Obj.value;
}
//-->
</SCRIPT>
<cfparam name="txt1Obj" default="">
<cfparam name="txt2Obj" default="">
<cfoutput>
<form action="../action/return.html" method="get"
enctype="application/x-www-form-urlencoded">
<p align="center"><strong><span class="style2">Price: </span>
<input type="text" name="txt1Obj" value=""> </strong> </p>
<p align="center"><strong><span class="style2">Quantity:</span>
<input type="text" name="txt2Obj" value=""> </strong> </p>
<p align="center"><strong><span class="style4">Total:</span>
<input onclick="checkValue" value="" name="thisTxt"
type="text"></input>
</form>
</cfoutput>
Thanks
<SCRIPT language="JavaScript">
function checkValue(thisTxt, tbox1Id, tbox2Id)
<!--
{
var txt1Obj = document.getElementById(tbox1Id);
var txt2Obj = document.getElementById(tbox2Id);
thisTxt.value = txt1Obj.value * txt2Obj.value;
}
//-->
</SCRIPT>
<cfparam name="txt1Obj" default="">
<cfparam name="txt2Obj" default="">
<cfoutput>
<form action="../action/return.html" method="get"
enctype="application/x-www-form-urlencoded">
<p align="center"><strong><span class="style2">Price: </span>
<input type="text" name="txt1Obj" value=""> </strong> </p>
<p align="center"><strong><span class="style2">Quantity:</span>
<input type="text" name="txt2Obj" value=""> </strong> </p>
<p align="center"><strong><span class="style4">Total:</span>
<input onclick="checkValue" value="" name="thisTxt"
type="text"></input>
</form>
</cfoutput>
Thanks