Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Script error Function GoFigure not recognized

    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>
    Last edited by tcosmas; 07-24-2002 at 02:12 PM.

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    there isn't any script, or url. something went wrong somewhere, so try again.
    Last edited by joh6nn; 07-24-2002 at 09:01 AM.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Added the Code to the original

    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.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #5
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CASE Sensitive. Who'd've thought!

    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!

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

    Thanks!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •