Dean Forant
04-23-2004, 02:22 PM
Hey Group.. I have a small problem it seems like its really simple..
I have a Form Field that puts a base price from a Mysql database..
now theres a Radio Button that shows up for an additional option..
I tried writing a function to take the base price of the Form field and add 80 to it and then in the radio button I call the function with an onClick Event. for the Yes Radio Button..
whats happening is instead of adding 80 to the base price its conacticating them together.. I know the + is used for both Addition and Conecticating strings together..
heres a copy of my code..
The Function
<Script Language="JavaScript">
function SPKUpdate()
{
var SPKBase=document.Options.PriceSPK.value;
var InboardAdder = 80;
var SPKTotal = SPKBase+InboardAdder;
document.Options.PriceSPK.value = SPKTotal
}
</Script>
heres the snippet of code where this function is called
<tr>
<td><center>
<input name="Selected<%response.write Prod %>" type="radio" value="Yes" onClick="SPKUpdate()">
Yes
<input name="Selected<%response.write Prod %>" type="radio" value="No" checked>
No </center></td>
don't mind the ASP Generated Names of the form.. thats setting the name of the form element based on the Product code from the database.. and it works..
any suggestions??
I have a Form Field that puts a base price from a Mysql database..
now theres a Radio Button that shows up for an additional option..
I tried writing a function to take the base price of the Form field and add 80 to it and then in the radio button I call the function with an onClick Event. for the Yes Radio Button..
whats happening is instead of adding 80 to the base price its conacticating them together.. I know the + is used for both Addition and Conecticating strings together..
heres a copy of my code..
The Function
<Script Language="JavaScript">
function SPKUpdate()
{
var SPKBase=document.Options.PriceSPK.value;
var InboardAdder = 80;
var SPKTotal = SPKBase+InboardAdder;
document.Options.PriceSPK.value = SPKTotal
}
</Script>
heres the snippet of code where this function is called
<tr>
<td><center>
<input name="Selected<%response.write Prod %>" type="radio" value="Yes" onClick="SPKUpdate()">
Yes
<input name="Selected<%response.write Prod %>" type="radio" value="No" checked>
No </center></td>
don't mind the ASP Generated Names of the form.. thats setting the name of the form element based on the Product code from the database.. and it works..
any suggestions??