C
cwizard
I'm calling on a function from within this form, and there are values set
but every time it gets called I get slammed with a run time error...
document.frmKitAmount.txtTotalKitValue is null or not an object... the
function is like so:
function calc_total()
{
var x,i,base,margin,total,newmargin,newtotal;
base = document.frmKitAmount.txtTotalKitValue.value;
margin = document.frmKitAmount.margin.value/100;
total = document.frmKitAmount.total.value;
newtotal = (1 + margin) * base;
document.frmKitAmount.total.value = FormatNumber(newtotal,2,false,true);
}
formatnumber() is elsewhere and it should work fine... the error happens on
the part where i assign the variable base to be equal to the form value
txtTotalKitValue... which is there..... i'm a newbie, and i'm working with
code thats already in place trying to add a couple little functions to
basically just display a marked up price in a text box below a current
price...
to see this page in action please go to http://67.66.56.168/gss/Corporate
and in the URL change msg=Fast to msg=QLG and hit enter. go to any of the
yellow tabs on the top. I appreciate any replies
<form name="frmKitAmt">
<input type="hidden" name="itemname"
value="<%=Server.HTMLEncode(objKitList.Name)%>">
<input type="hidden" name="imglink" value="<%=imgLink & objKitList.Image%>">
<input type="hidden" name="description"
value="<%=Server.HTMLEncode(objKitList.Description)%>">
<table border= "0" cellspacing="1" cellpadding="0" width="95%">
<%If objKitList.CallForPrice then%>
<input type="hidden" name="txtTotalKitValue">
<tr>
<td class=siteNav1TD valign="middle" colspan="3">
<img src="images/blank.gif">
</td></tr>
<%Else%>
<tr>
<td class=siteNav1TD valign="middle">
<table width="100%">
<tr>
<td colspan="3" align="center" valign="middle">
<font face="Verdana" size="2" color="#ffffff"><strong>Base
Price:</strong> </font>
</td>
<td>
<font face="Verdana" size="2"
color="#ffffff"><strong><%=g_currencyString%> <%=FormatNumber(objkitlis
t.price * Markup,2)%></strong></font>
</td>
<td valign="middle">
<font face="Verdana" size="2" color="#FFFFFF"><strong>Your Price:
<%=g_currencyString%> </strong></font>
<input type="text" name="txtTotalKitValue"
value="<%=FormatNumber(objKitList.Price * Markup,2)%>" size="10"
onFocus="this.blur();">
</td>
</tr>
<tr>
<td colspan="4" align="center" valign="middle">
<font face="Verdana" size="2" color="#FFFFFF"><strong>Markup:
</strong></font>
<input type="text" name="margin" value="0" size="10"
onblur="calc_total();">
</td>
<td valign="middle">
<font face="Verdana" size="2" color="#FFFFFF"><strong>End Price:
<%=g_currencyString%> </strong></font>
<input type="text" name="total" value="<%=FormatNumber(objKitList.Price
* Markup,2)%>" size="10">
</td>
</tr>
</table>
</td>
<td class=siteNav1TD valign="middle" align="center"<%if Not
objKitList.ClubTotals then%>colspan="2"<%End if%> >
<font face="Verdana" size="1" color="#FFFFFF"><b>Quantity :</b><br>
<input name="qty" type="text" size="4" maxlength="4" value="<%If
objKitList.Qty > 0 Then%><%=objKitList.Qty%><%Else%>1<%End If%>"></font>
</td>
</tr>
<%End if%>
<tr>
<td colspan="3" height="20"><font face="Verdana" size="1">To take a
printable
version of this Kit <a href="javascriptrintkit();"
class="msn"><strong>Click here.</strong></a></font></td>
</tr>
<tr>
<td><font face="verdana" size=1><b>Item Name</b></td>
<%if Not objKitList.ClubTotals and not objKitList.CallForPrice then%>
<td align="center"><font face="verdana" size=1><b>Price</b></td>
<%End if%>
<td align="center"><font face="verdana" size=1><b>Qty</b></td>
</tr>
<!--
</table>-->
</form>
but every time it gets called I get slammed with a run time error...
document.frmKitAmount.txtTotalKitValue is null or not an object... the
function is like so:
function calc_total()
{
var x,i,base,margin,total,newmargin,newtotal;
base = document.frmKitAmount.txtTotalKitValue.value;
margin = document.frmKitAmount.margin.value/100;
total = document.frmKitAmount.total.value;
newtotal = (1 + margin) * base;
document.frmKitAmount.total.value = FormatNumber(newtotal,2,false,true);
}
formatnumber() is elsewhere and it should work fine... the error happens on
the part where i assign the variable base to be equal to the form value
txtTotalKitValue... which is there..... i'm a newbie, and i'm working with
code thats already in place trying to add a couple little functions to
basically just display a marked up price in a text box below a current
price...
to see this page in action please go to http://67.66.56.168/gss/Corporate
and in the URL change msg=Fast to msg=QLG and hit enter. go to any of the
yellow tabs on the top. I appreciate any replies
<form name="frmKitAmt">
<input type="hidden" name="itemname"
value="<%=Server.HTMLEncode(objKitList.Name)%>">
<input type="hidden" name="imglink" value="<%=imgLink & objKitList.Image%>">
<input type="hidden" name="description"
value="<%=Server.HTMLEncode(objKitList.Description)%>">
<table border= "0" cellspacing="1" cellpadding="0" width="95%">
<%If objKitList.CallForPrice then%>
<input type="hidden" name="txtTotalKitValue">
<tr>
<td class=siteNav1TD valign="middle" colspan="3">
<img src="images/blank.gif">
</td></tr>
<%Else%>
<tr>
<td class=siteNav1TD valign="middle">
<table width="100%">
<tr>
<td colspan="3" align="center" valign="middle">
<font face="Verdana" size="2" color="#ffffff"><strong>Base
Price:</strong> </font>
</td>
<td>
<font face="Verdana" size="2"
color="#ffffff"><strong><%=g_currencyString%> <%=FormatNumber(objkitlis
t.price * Markup,2)%></strong></font>
</td>
<td valign="middle">
<font face="Verdana" size="2" color="#FFFFFF"><strong>Your Price:
<%=g_currencyString%> </strong></font>
<input type="text" name="txtTotalKitValue"
value="<%=FormatNumber(objKitList.Price * Markup,2)%>" size="10"
onFocus="this.blur();">
</td>
</tr>
<tr>
<td colspan="4" align="center" valign="middle">
<font face="Verdana" size="2" color="#FFFFFF"><strong>Markup:
</strong></font>
<input type="text" name="margin" value="0" size="10"
onblur="calc_total();">
</td>
<td valign="middle">
<font face="Verdana" size="2" color="#FFFFFF"><strong>End Price:
<%=g_currencyString%> </strong></font>
<input type="text" name="total" value="<%=FormatNumber(objKitList.Price
* Markup,2)%>" size="10">
</td>
</tr>
</table>
</td>
<td class=siteNav1TD valign="middle" align="center"<%if Not
objKitList.ClubTotals then%>colspan="2"<%End if%> >
<font face="Verdana" size="1" color="#FFFFFF"><b>Quantity :</b><br>
<input name="qty" type="text" size="4" maxlength="4" value="<%If
objKitList.Qty > 0 Then%><%=objKitList.Qty%><%Else%>1<%End If%>"></font>
</td>
</tr>
<%End if%>
<tr>
<td colspan="3" height="20"><font face="Verdana" size="1">To take a
printable
version of this Kit <a href="javascriptrintkit();"
class="msn"><strong>Click here.</strong></a></font></td>
</tr>
<tr>
<td><font face="verdana" size=1><b>Item Name</b></td>
<%if Not objKitList.ClubTotals and not objKitList.CallForPrice then%>
<td align="center"><font face="verdana" size=1><b>Price</b></td>
<%End if%>
<td align="center"><font face="verdana" size=1><b>Qty</b></td>
</tr>
<!--
</table>-->
</form>