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 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Very new to JS need help

    I have a script written, but it won't format numbers like I need it to. Here is the script, what am I doing wrong? Please be specific and simple as I am very new to JS. Thanks in advance.

    <!-- CALCULATOR -->

    <html>
    <head>
    <title>Calculator</title>

    <script language="JavaScript">

    function CommaFormatted(amount)
    {
    var delimiter = ",";
    var a = amount.split('.',2)
    var d = j[1];
    var i = parseInt(a[0]);
    if(isNaN(i)) { return ''; }
    var minus = '';
    if(i < 0) { minus = '-'; }
    i = Math.abs(i);
    var n = new String(i);
    var a = [];
    while(n.length > 3)
    {
    var nn = n.substr(n.length-3);
    j.unshift(nn);
    n = n.substr(0,n.length-3);
    }
    if(n.length > 0) { a.unshift(n); }
    n = a.join(delimiter);
    if(d.length < 1) { amount = n; }
    else { amount = n + '.' + d; }
    amount = minus + amount;
    return amount;
    }



    function CalculateSum(Atext, Btext, Ctext, Dtext, Etext, Ftext, Gtext, form)
    {
    var A = parseFloat(Atext);
    var B = parseFloat(Btext);
    var C = parseFloat(Ctext);
    var D = parseFloat(Dtext)/100;
    var E = parseFloat(Etext);
    var F = parseFloat(Ftext);
    var G = parseFloat(Gtext);
    var H = parseFloat(E+F)/100;
    var result = parseFloat ((A * B * 30)*(1-D)*(1-H)*(G/100)-C);

    form.result.value= result;
    }


    function ClearForm(form)
    {
    form.input_A.value = "";
    form.input_B.value = "";
    form.input_C.value = "";
    form.input_D.value = "";
    form.input_E.value = "";
    form.input_F.value = "";
    form.input_G.value = "";
    form.result.value = "";
    }

    </script>

    </head>
    <body text="white" bgcolor="#990000" background="">

    <p><div align="left"><strong><font color="#ffff00" size="2">
    <TABLE borderColor=#ff0000 width="100%" border=6>

    <TR><!-- Row 1 -->
    <TD>
    <P align=center><STRONG><FONT color=#ffff00 size=2>Net
    Profit&nbsp;Calculator</FONT> <font color="#ffff00" size="2">For Oil &amp; Gas
    Wells</font></STRONG></P></TD><!-- Col 1 --></TR></TABLE>
    </font></strong></div><font size="5">
    <center>
    <table height="320" width="956" align="left" border="0">
    <TBODY>

    <tr><!-- Row 1 -->
    <td>
    <DIV align=center>

    <form name="Calculator" method="post">
    <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;<BR>
    <TABLE width="100%" border=0>

    <TR><!-- Row 1 -->
    <TD width=443>
    <P align=right>Total Daily Production&nbsp;</P></TD><!-- Col 1 -->
    <TD>
    <input style="WIDTH: 98px; HEIGHT: 25px" size="4"
    name="input_A">&nbsp;<FONT size=1>(All Wells)&nbsp;</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 2 -->
    <TD width=443>
    <P align=right>Price
    Per&nbsp;Unit <FONT size=2>$</FONT>&nbsp;</P></TD><!-- Col 1 -->
    <TD>


    <input style="WIDTH: 96px; HEIGHT: 25px" size="4" name="input_B"
    >&nbsp;<FONT size=1>(Barrel / MCF)</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 3 -->
    <TD width=443>
    <P align=right>

    Field Expenses&nbsp;<font size="4"><font size="2">$</font></font></P></TD><!-- Col 1 -->
    <TD><input style="WIDTH: 94px; HEIGHT: 25px" size="3" name="input_C"
    >&nbsp;<FONT size=1>(Monthly Supervision and
    Maintainence)</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 4 -->
    <TD width=443>
    <P align=right>State Severance Tax&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD>

    <input style="HEIGHT: 25px" size="4" name="input_D"> <font size="1">(State
    Tax)</font></TD><!-- Col 2 --></TR>
    <TR><!-- Row 5 -->
    <TD width=443>
    <P align=right>LORI&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD>
    <input style="HEIGHT: 25px" size="4" name="input_E">&nbsp;<FONT size=1>(Land Owner Royalty
    Interest)</FONT>&nbsp;</TD><!-- Col 2 --></TR>
    <TR><!-- Row 6 -->
    <TD width=443>
    <P align=right>ORRI&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD>
    <input style="HEIGHT: 25px" size="4" name="input_F">&nbsp;<FONT size=1>(Override Royalty
    Interest)</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 7 -->
    <TD width=443>
    <P align=right>NRI&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD> <input style="HEIGHT: 25px" size="4" name="input_G">&nbsp;<FONT size=1>(Net Revenue
    Interest&nbsp;of
    Investor)</FONT></TD><!-- Col 2 --></TR></TABLE>&nbsp;
    <TABLE width="100%" border=0>

    <TR><!-- Row 1 -->
    <TD>
    <P align=center>

    <input style="WIDTH: 189px; HEIGHT: 28px" onclick="CalculateSum(this.form.input_A.value, this.form.input_B.value, this.form.input_C.value, this.form.input_D.value, this.form.input_E.value, this.form.input_F.value, this.form.input_G.value, this.form)" type="button" size="34" value="Click Here to Calculate" name="AddButton"></P></TD><!-- Col 1 --></TR></TABLE>&nbsp;<font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <TABLE height=53 width=950 border=0>

    <TR><!-- Row 1 -->
    <TD width=446>
    <P align=right><STRONG>Net Profit</STRONG>&nbsp; $</P></TD><!-- Col 1 -->
    <TD> <input size="7" name="result" style="WIDTH: 93px; HEIGHT: 25px">&nbsp;<FONT size=2>Per Month</FONT><FONT
    size=1>&nbsp;
    </FONT></TD><!-- Col 2 --></TR></TABLE></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <TABLE width="100%" border=0>

    <TR><!-- Row 1 -->
    <TD>
    <P align=center>

    <input style="WIDTH: 108px; HEIGHT: 28px" onclick="ClearForm(this.form)" type="button" size="16" value="Reset Form" name="ClearButton"></P></TD><!-- Col 1 --></TR></TABLE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;
    <br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br><br>&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
    </form></DIV><br></font></TD><!-- Col 1 --></TR></TBODY></TABLE></CENTER></FONT>





    </body>
    </html>

  • #2
    New Coder
    Join Date
    Feb 2007
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This is in the wrong forum. This should be in javascript not java/jsp
    Also you might want to put <code></code> between your codes so that it is easier to view

  • #3
    New Coder
    Join Date
    Aug 2007
    Posts
    20
    Thanks
    0
    Thanked 1 Time in 1 Post

    Thumbs up

    hi,
    There is a problem in the JS function used for splitting commas.
    the new code is pasted below. Its working fine on my PC.
    Please get back in case of concerns.

    <html>
    <head>
    <title>Calculator</title>

    <script language="JavaScript">

    function CommaFormatted(sNum)
    {
    var sNew="";
    var sTemp = sNum.split(",");
    for (i=0;i<sTemp.length;i++)
    {
    if (sTemp[i]!=null)
    sNew = sNew + sTemp[i];
    }
    return(sNew);

    }



    function CalculateSum(Atext, Btext, Ctext, Dtext, Etext, Ftext, Gtext, form)
    {
    var A = parseFloat(CommaFormatted(Atext));

    var B = parseFloat(Btext);
    var C = parseFloat(Ctext);
    var D = parseFloat(Dtext)/100;
    var E = parseFloat(Etext);
    var F = parseFloat(Ftext);
    var G = parseFloat(Gtext);
    var H = parseFloat(E+F)/100;

    alert(A);
    var result = parseFloat ((A * B * 30)*(1-D)*(1-H)*(G/100)-C);
    alert("result" +result);
    form.result.value= result;
    }


    function ClearForm(form)
    {
    form.input_A.value = "";
    form.input_B.value = "";
    form.input_C.value = "";
    form.input_D.value = "";
    form.input_E.value = "";
    form.input_F.value = "";
    form.input_G.value = "";
    form.result.value = "";
    }

    </script>

    </head>
    <body text="white" bgcolor="#990000" background="">

    <p><div align="left"><strong><font color="#ffff00" size="2">
    <TABLE borderColor=#ff0000 width="100%" border=6>

    <TR><!-- Row 1 -->
    <TD>
    <P align=center><STRONG><FONT color=#ffff00 size=2>Net
    Profit&nbsp;Calculator</FONT> <font color="#ffff00" size="2">For Oil &amp; Gas
    Wells</font></STRONG></P></TD><!-- Col 1 --></TR></TABLE>
    </font></strong></div><font size="5">
    <center>
    <table height="320" width="956" align="left" border="0">
    <TBODY>

    <tr><!-- Row 1 -->
    <td>
    <DIV align=center>

    <form name="Calculator" method="post">
    <P align=left>&nbsp;&nbsp;&nbsp;&nbsp;<BR>
    <TABLE width="100%" border=0>

    <TR><!-- Row 1 -->
    <TD width=443>
    <P align=right>Total Daily Production&nbsp;</P></TD><!-- Col 1 -->
    <TD>
    <input style="WIDTH: 98px; HEIGHT: 25px" size="4"
    name="input_A">&nbsp;<FONT size=1>(All Wells)&nbsp;</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 2 -->
    <TD width=443>
    <P align=right>Price
    Per&nbsp;Unit <FONT size=2>$</FONT>&nbsp;</P></TD><!-- Col 1 -->
    <TD>


    <input style="WIDTH: 96px; HEIGHT: 25px" size="4" name="input_B"
    >&nbsp;<FONT size=1>(Barrel / MCF)</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 3 -->
    <TD width=443>
    <P align=right>

    Field Expenses&nbsp;<font size="4"><font size="2">$</font></font></P></TD><!-- Col 1 -->
    <TD><input style="WIDTH: 94px; HEIGHT: 25px" size="3" name="input_C"
    >&nbsp;<FONT size=1>(Monthly Supervision and
    Maintainence)</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 4 -->
    <TD width=443>
    <P align=right>State Severance Tax&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD>

    <input style="HEIGHT: 25px" size="4" name="input_D"> <font size="1">(State
    Tax)</font></TD><!-- Col 2 --></TR>
    <TR><!-- Row 5 -->
    <TD width=443>
    <P align=right>LORI&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD>
    <input style="HEIGHT: 25px" size="4" name="input_E">&nbsp;<FONT size=1>(Land Owner Royalty
    Interest)</FONT>&nbsp;</TD><!-- Col 2 --></TR>
    <TR><!-- Row 6 -->
    <TD width=443>
    <P align=right>ORRI&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD>
    <input style="HEIGHT: 25px" size="4" name="input_F">&nbsp;<FONT size=1>(Override Royalty
    Interest)</FONT></TD><!-- Col 2 --></TR>
    <TR><!-- Row 7 -->
    <TD width=443>
    <P align=right>NRI&nbsp;&nbsp;%</P></TD><!-- Col 1 -->
    <TD> <input style="HEIGHT: 25px" size="4" name="input_G">&nbsp;<FONT size=1>(Net Revenue
    Interest&nbsp;of
    Investor)</FONT></TD><!-- Col 2 --></TR></TABLE>&nbsp;
    <TABLE width="100%" border=0>

    <TR><!-- Row 1 -->
    <TD>
    <P align=center>

    <input style="WIDTH: 189px; HEIGHT: 28px" onclick="CalculateSum(this.form.input_A.value, this.form.input_B.value, this.form.input_C.value, this.form.input_D.value, this.form.input_E.value, this.form.input_F.value, this.form.input_G.value, this.form)" type="button" size="34" value="Click Here to Calculate" name="AddButton"></P></TD><!-- Col 1 --></TR></TABLE>&nbsp;<font size="1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;
    <TABLE height=53 width=950 border=0>

    <TR><!-- Row 1 -->
    <TD width=446>
    <P align=right><STRONG>Net Profit</STRONG>&nbsp; $</P></TD><!-- Col 1 -->
    <TD> <input size="7" name="result" style="WIDTH: 93px; HEIGHT: 25px">&nbsp;<FONT size=2>Per Month</FONT><FONT
    size=1>&nbsp;
    </FONT></TD><!-- Col 2 --></TR></TABLE></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <TABLE width="100%" border=0>

    <TR><!-- Row 1 -->
    <TD>
    <P align=center>

    <input style="WIDTH: 108px; HEIGHT: 28px" onclick="CommaFormatted(this.form.input_A.value)" type="button" size="16" value="Reset Form" name="ClearButton"></P></TD><!-- Col 1 --></TR></TABLE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P>
    </form></DIV><br></font></TD><!-- Col 1 --></TR></TBODY></TABLE></CENTER></FONT>





    </body>
    </html>

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    Please don't post wodges of irrelevant code, and please look at the posting guidelines re silly thread titles.

    A much better script to format with commas is

    <script type = "text/javascript">

    function addCommas2(nStr) {
    num = 123456789;
    num = num.toString(); // must be a string
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(nStr)) {
    nStr = nStr.replace(rgx, '$1' + ',' + '$2');
    }
    alert (nStr);
    }

    </script>


  •  

    Posting Permissions

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