...

View Full Version : Script error Function GoFigure not recognized



tcosmas
07-23-2002, 11:09 PM
Can someone, PLEASE look into the uploaded script and let me know where the error is. It's a simple form in which a user enters the number of pages which are needed to be copied and the Submit button should calculate the number of pages in each category, cost of copying each group of pages and total cost.

I can't figure out where I went wrong.:(

Your help is realllllllyyyyy appreciated!!!

Thanks.:)

>>>CODE FOLLOWS>>>

<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<TITLE>OPRA Copy Cost</TITLE>
<!--
<SCRIPT LANGUAGE="JAVASCRIPT">
Function GoFigure() {
var frstten = 0;
var scndten = 0;
var allrest = 0;
var totalcost = 0;

numpg = document.form.CopyCostForm.NUMBPG.value;
If ( numbpg < 10) then
frstten = numbpg;
}
If ( numbpg > 10 && numbpg < 21) {
frstten = 10;
scndten = numbpg - 10;
}
If ( numbpg > 20) {
frstten = 10;
scndten = 10;
allrest = numbpg - 20;
}
document.form.CopyCostForm.FIRSTTENCOST.value = frstten * 0.75;
document.form.CopyCostForm.SECONDTENCOST.value = scndten * 0.5;
document.form.CopyCostForm.ALLTHERESTCOST.value = allrest * 0.25;
document.form.CopyCostForm.TOTALCOST.value = (frstten * 0.75) + (scndten * 0.5) + (allrest * 0.25);
}
</SCRIPT>
-->
</HEAD>
<BODY>
<FORM name="CopyCostForm" onSubmit="GoFigure()">
<Table border=1>
<TR VALIGN="bottom">
<TD COLSPAN=5 ALIGN="center"><FONT FACE="Arial" SIZE=+2><B>OPRA Copying Cost Estimator</B></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD ALIGN="left"><FONT FACE="Arial"><B>Number of Pages</B></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD BGCOLOR=#CCFFCC ALIGN="center"><FONT FACE="Arial"><INPUT TYPE=TEXT SIZE=5 NAME="NUMBPG"></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD ALIGN="left"><FONT FACE="Arial"><B>Cost Breakdown</B></FONT></TD>
<TD ALIGN="left"><FONT FACE="Arial"><B>Unit Cost</B></FONT></TD>
<TD ALIGN="left"><FONT FACE="Arial"><B>Number</B></FONT></TD>
<TD ALIGN="left"><FONT FACE="Arial"><B>Cost</B></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD ALIGN="left"><FONT FACE="Arial">Pages 1 to 10:</FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial">0.75 </FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial"><INPUT TYPE=TEXT NAME="FIRSTTEN" size=7></FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial"><INPUT TYPE=TEXT NAME="FIRSTTENCOST" size=7></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD ALIGN="left"><FONT FACE="Arial">Pages 11 to 20:</FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial">0.50 </FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial"><INPUT TYPE=TEXT NAME="SECONDTEN" size=7></FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial"><INPUT TYPE=TEXT NAME="SECONDTENCOST" size=7></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR VALIGN="bottom">
<TD ALIGN="left"><FONT FACE="Arial">All pages after 20:</FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial">0.25 </FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial"><INPUT TYPE=TEXT NAME="ALLTHEREST" SIZE=5></FONT></TD>
<TD ALIGN="right"><FONT FACE="Arial"><INPUT TYPE=TEXT NAME="ALLTHERESTCOST" SIZE=7></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
</TR>
<TR BGCOLOR=#FFFF00 VALIGN="bottom">
<TD ALIGN="right" VALIGN="top"><FONT FACE="Arial"><b>Total Cost</b></FONT></TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right">&nbsp;</TD>
<TD ALIGN="right"><FONT FACE="Arial"><B><INPUT TYPE=TEXT NAME="TOTALCOST" SIZE=7></B></FONT></TD>
<TD COLSPAN=3 ALIGN="center"><FONT FACE="Arial">&lt; - Copy this cell to paste into OPRA worksheet.</FONT></TD></TR>
</Table>
<INPUT TYPE="SUBMIT" VALUE="Click Me to Update Total Cost">
</form><p>
<FONT SIZE=-1><I>Last Updated on 7/23/02
<BR>By Tom Cosmas</I>
</FONT>
</BODY>
</HTML>

joh6nn
07-24-2002, 09:54 AM
there isn't any script, or url. something went wrong somewhere, so try again.

tcosmas
07-24-2002, 03:14 PM
When I was composing the e-mail, I pointed the composer to the file location. Something must have gone wrong. So I went back and pasted the code into the original message.

Thanks.

mordred
07-24-2002, 03:28 PM
The javascript interpreter can't find any function GoFigure, because all you have is a Function GoFigure.
See the difference?

Same applies to the If statements, if your script shall work properly.

tcosmas
07-24-2002, 08:48 PM
The case was part of the problem. I also found that one variable was misspelt and the call should have been GoFigure(NUMBPG.value). Otherwise, NS is passing the HTML code for that INPUT tag. Duh! :mad:

Got it working now and even spiffied it up a bit with a Currency Converter from The JavaScript Source (http://javascript.internet.com/forms/currency-format.html).

Thanks!!! :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum