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.frmKit Amount.txtTotal KitValue is null or not an object... the
function is like so:
function calc_total()
{
var x,i,base,margin ,total,newmargi n,newtotal;
base = document.frmKit Amount.txtTotal KitValue.value;
margin = document.frmKit Amount.margin.v alue/100;
total = document.frmKit Amount.total.va lue;
newtotal = (1 + margin) * base;
document.frmKit Amount.total.va lue = FormatNumber(ne wtotal,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
txtTotalKitValu e... 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="<%=Serve r.HTMLEncode(ob jKitList.Name)% >">
<input type="hidden" name="imglink" value="<%=imgLi nk & objKitList.Imag e%>">
<input type="hidden" name="descripti on"
value="<%=Serve r.HTMLEncode(ob jKitList.Descri ption)%>">
<table border= "0" cellspacing="1" cellpadding="0" width="95%">
<%If objKitList.Call ForPrice then%>
<input type="hidden" name="txtTotalK itValue">
<tr>
<td class=siteNav1T D valign="middle" colspan="3">
<img src="images/blank.gif">
</td></tr>
<%Else%>
<tr>
<td class=siteNav1T D 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_c urrencyString%> <%=Format Number(objkitli s
t.price * Markup,2)%></strong></font>
</td>
<td valign="middle" >
<font face="Verdana" size="2" color="#FFFFFF" ><strong>Your Price:
<%=g_currencySt ring%> </strong></font>
<input type="text" name="txtTotalK itValue"
value="<%=Forma tNumber(objKitL ist.Price * Markup,2)%>" size="10"
onFocus="this.b lur();">
</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_to tal();">
</td>
<td valign="middle" >
<font face="Verdana" size="2" color="#FFFFFF" ><strong>End Price:
<%=g_currencySt ring%> </strong></font>
<input type="text" name="total" value="<%=Forma tNumber(objKitL ist.Price
* Markup,2)%>" size="10">
</td>
</tr>
</table>
</td>
<td class=siteNav1T D valign="middle" align="center"< %if Not
objKitList.Club Totals 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%><%=objKit List.Qty%><%Els e%>1<%End If%>"></font>
</td>
</tr>
<%End if%>
<tr>
<td colspan="3" height="20"><fo nt face="Verdana" size="1">To take a
printable
version of this Kit <a href="javascrip t:printkit();"
class="msn"><st rong>Click here.</strong></a></font></td>
</tr>
<tr>
<td><font face="verdana" size=1><b>Item Name</b></td>
<%if Not objKitList.Club Totals and not objKitList.Call ForPrice 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.frmKit Amount.txtTotal KitValue is null or not an object... the
function is like so:
function calc_total()
{
var x,i,base,margin ,total,newmargi n,newtotal;
base = document.frmKit Amount.txtTotal KitValue.value;
margin = document.frmKit Amount.margin.v alue/100;
total = document.frmKit Amount.total.va lue;
newtotal = (1 + margin) * base;
document.frmKit Amount.total.va lue = FormatNumber(ne wtotal,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
txtTotalKitValu e... 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="<%=Serve r.HTMLEncode(ob jKitList.Name)% >">
<input type="hidden" name="imglink" value="<%=imgLi nk & objKitList.Imag e%>">
<input type="hidden" name="descripti on"
value="<%=Serve r.HTMLEncode(ob jKitList.Descri ption)%>">
<table border= "0" cellspacing="1" cellpadding="0" width="95%">
<%If objKitList.Call ForPrice then%>
<input type="hidden" name="txtTotalK itValue">
<tr>
<td class=siteNav1T D valign="middle" colspan="3">
<img src="images/blank.gif">
</td></tr>
<%Else%>
<tr>
<td class=siteNav1T D 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_c urrencyString%> <%=Format Number(objkitli s
t.price * Markup,2)%></strong></font>
</td>
<td valign="middle" >
<font face="Verdana" size="2" color="#FFFFFF" ><strong>Your Price:
<%=g_currencySt ring%> </strong></font>
<input type="text" name="txtTotalK itValue"
value="<%=Forma tNumber(objKitL ist.Price * Markup,2)%>" size="10"
onFocus="this.b lur();">
</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_to tal();">
</td>
<td valign="middle" >
<font face="Verdana" size="2" color="#FFFFFF" ><strong>End Price:
<%=g_currencySt ring%> </strong></font>
<input type="text" name="total" value="<%=Forma tNumber(objKitL ist.Price
* Markup,2)%>" size="10">
</td>
</tr>
</table>
</td>
<td class=siteNav1T D valign="middle" align="center"< %if Not
objKitList.Club Totals 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%><%=objKit List.Qty%><%Els e%>1<%End If%>"></font>
</td>
</tr>
<%End if%>
<tr>
<td colspan="3" height="20"><fo nt face="Verdana" size="1">To take a
printable
version of this Kit <a href="javascrip t:printkit();"
class="msn"><st rong>Click here.</strong></a></font></td>
</tr>
<tr>
<td><font face="verdana" size=1><b>Item Name</b></td>
<%if Not objKitList.Club Totals and not objKitList.Call ForPrice 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>
Comment