JavaScript - Need Total With Decimals, Not Rounded Up
Hi, I need my javascript to calculate a total with 2x decimal figures, not rounded up. Can you help? Here is my code:
Code: <script type="text/javascript"> function calculateText() { var op1=document.getElementById('Age02'); var op2=document.getElementById('Girl35'); var op3=document.getElementById('Boy35'); var op4=document.getElementById('Girl610'); var op5=document.getElementById('Boy610'); var op6=document.getElementById('Age11'); var op7=document.getElementById('Guest'); var op8=document.getElementById('VIP'); var op9=document.getElementById('School'); var op10=document.getElementById('3DFilm'); var op11=document.getElementById('BFast'); var op12=document.getElementById('PNGift'); var op13=document.getElementById('PStand'); var op14=document.getElementById('PLrg'); var op15=document.getElementById('PReP'); var op16=document.getElementById('KyMg'); var op17=document.getElementById('SnwGlb'); var op18=document.getElementById('PBbl'); var op19=document.getElementById('USB'); var op20=document.getElementById('SantaL'); var op21=document.getElementById('SantaK'); var op22=document.getElementById('FreeP'); var op23=document.getElementById('PUpgrd'); var op24=document.getElementById('StaffP'); var op25=document.getElementById('CompEntry'); var op26=document.getElementById('241'); var op27=document.getElementById('50Percent'); var op28=document.getElementById('Voucher'); var result=document.getElementById('Total'); if(op1.value=="" || op1.value!=parseFloat(op1.value)) op1.value=0; if(op2.value=="" || op2.value!=parseFloat(op2.value)) op2.value=0; if(op3.value=="" || op3.value!=parseFloat(op3.value)) op3.value=0; if(op4.value=="" || op4.value!=parseFloat(op4.value)) op4.value=0; if(op5.value=="" || op5.value!=parseFloat(op5.value)) op5.value=0; if(op6.value=="" || op6.value!=parseFloat(op6.value)) op6.value=0; if(op7.value=="" || op7.value!=parseFloat(op7.value)) op7.value=0; if(op8.value=="" || op8.value!=parseFloat(op8.value)) op8.value=0; if(op9.value=="" || op9.value!=parseFloat(op9.value)) op9.value=0; if(op10.value=="" || op10.value!=parseFloat(op10.value)) op10.value=0; if(op11.value=="" || op11.value!=parseFloat(op11.value)) op11.value=0; if(op12.value=="" || op12.value!=parseFloat(op12.value)) op12.value=0; if(op13.value=="" || op13.value!=parseFloat(op13.value)) op13.value=0; if(op14.value=="" || op14.value!=parseFloat(op14.value)) op14.value=0; if(op15.value=="" || op15.value!=parseFloat(op15.value)) op15.value=0; if(op16.value=="" || op16.value!=parseFloat(op16.value)) op16.value=0; if(op17.value=="" || op17.value!=parseFloat(op17.value)) op17.value=0; if(op18.value=="" || op18.value!=parseFloat(op18.value)) op18.value=0; if(op19.value=="" || op19.value!=parseFloat(op19.value)) op19.value=0; if(op20.value=="" || op20.value!=parseFloat(op20.value)) op20.value=0; if(op21.value=="" || op21.value!=parseFloat(op21.value)) op21.value=0; if(op22.value=="" || op22.value!=parseFloat(op22.value)) op22.value=0; if(op23.value=="" || op23.value!=parseFloat(op23.value)) op23.value=0; if(op24.value=="" || op24.value!=parseFloat(op24.value)) op24.value=0; if(op25.value=="" || op25.value!=parseFloat(op25.value)) op25.value=0; if(op26.value=="" || op26.value!=parseFloat(op26.value)) op26.value=0; if(op27.value=="" || op27.value!=parseFloat(op27.value)) op27.value=0; if(op28.value=="" || op28.value!=parseFloat(op28.value)) op28.value=0; result.value=0; result.value=parseInt(result.value); result.value=parseInt(result.value)+parseInt(op1.value*5)+parseInt(op2.value*5)+parseInt(op3.value*5)+parseInt(op4.value*5)+parseInt(op5.value*5)+parseInt(op6.value*5)+parseInt(op7.value*0)+parseInt(op8.value*8.50)+parseInt(op9.value*3.75)+parseInt(op10.value*0)+parseInt(op11.value*10)+parseInt(op12.value*5)+parseInt(op13.value*3)+parseInt(op14.value*4)+parseInt(op15.value*2)+parseInt(op16.value*4)+parseInt(op17.value*5)+parseInt(op18.value*3)+parseInt(op19.value*5)+parseInt(op20.value*4)+parseInt(op21.value*3)+parseInt(op22.value*0)+parseInt(op23.value*1)+parseInt(op24.value*0)+parseInt(op25.value*0)+parseInt(op26.value*4)+parseInt(op27.value*2)-parseInt(op28.value); } </script> Similar TutorialsHi, my javascript calculates a total figure. It rounds it up though and I want it to give me a decimal (x2) total. Please help. Here is my code so far: Code: <script type="text/javascript"> function calculateText() { var op1=document.getElementById('Age02'); var op2=document.getElementById('Girl35'); var op3=document.getElementById('Boy35'); var op4=document.getElementById('Girl610'); var op5=document.getElementById('Boy610'); var op6=document.getElementById('Age11'); var op7=document.getElementById('Guest'); var op8=document.getElementById('VIP'); var op9=document.getElementById('School'); var op10=document.getElementById('3DFilm'); var op11=document.getElementById('BFast'); var op12=document.getElementById('PNGift'); var op13=document.getElementById('PStand'); var op14=document.getElementById('PLrg'); var op15=document.getElementById('PReP'); var op16=document.getElementById('KyMg'); var op17=document.getElementById('SnwGlb'); var op18=document.getElementById('PBbl'); var op19=document.getElementById('USB'); var op20=document.getElementById('SantaL'); var op21=document.getElementById('SantaK'); var op22=document.getElementById('FreeP'); var op23=document.getElementById('PUpgrd'); var op24=document.getElementById('StaffP'); var op25=document.getElementById('CompEntry'); var op26=document.getElementById('241'); var op27=document.getElementById('50Percent'); var op28=document.getElementById('Voucher'); var result=document.getElementById('Total'); if(op1.value=="" || op1.value!=parseFloat(op1.value)) op1.value=0; if(op2.value=="" || op2.value!=parseFloat(op2.value)) op2.value=0; if(op3.value=="" || op3.value!=parseFloat(op3.value)) op3.value=0; if(op4.value=="" || op4.value!=parseFloat(op4.value)) op4.value=0; if(op5.value=="" || op5.value!=parseFloat(op5.value)) op5.value=0; if(op6.value=="" || op6.value!=parseFloat(op6.value)) op6.value=0; if(op7.value=="" || op7.value!=parseFloat(op7.value)) op7.value=0; if(op8.value=="" || op8.value!=parseFloat(op8.value)) op8.value=0; if(op9.value=="" || op9.value!=parseFloat(op9.value)) op9.value=0; if(op10.value=="" || op10.value!=parseFloat(op10.value)) op10.value=0; if(op11.value=="" || op11.value!=parseFloat(op11.value)) op11.value=0; if(op12.value=="" || op12.value!=parseFloat(op12.value)) op12.value=0; if(op13.value=="" || op13.value!=parseFloat(op13.value)) op13.value=0; if(op14.value=="" || op14.value!=parseFloat(op14.value)) op14.value=0; if(op15.value=="" || op15.value!=parseFloat(op15.value)) op15.value=0; if(op16.value=="" || op16.value!=parseFloat(op16.value)) op16.value=0; if(op17.value=="" || op17.value!=parseFloat(op17.value)) op17.value=0; if(op18.value=="" || op18.value!=parseFloat(op18.value)) op18.value=0; if(op19.value=="" || op19.value!=parseFloat(op19.value)) op19.value=0; if(op20.value=="" || op20.value!=parseFloat(op20.value)) op20.value=0; if(op21.value=="" || op21.value!=parseFloat(op21.value)) op21.value=0; if(op22.value=="" || op22.value!=parseFloat(op22.value)) op22.value=0; if(op23.value=="" || op23.value!=parseFloat(op23.value)) op23.value=0; if(op24.value=="" || op24.value!=parseFloat(op24.value)) op24.value=0; if(op25.value=="" || op25.value!=parseFloat(op25.value)) op25.value=0; if(op26.value=="" || op26.value!=parseFloat(op26.value)) op26.value=0; if(op27.value=="" || op27.value!=parseFloat(op27.value)) op27.value=0; if(op28.value=="" || op28.value!=parseFloat(op28.value)) op28.value=0; result.value=0; result.value=parseInt(result.value); result.value=parseInt(result.value)+parseInt(op1.value*5)+parseInt(op2.value*5)+parseInt(op3.value*5)+parseInt(op4.value*5)+parseInt(op5.value*5)+parseInt(op6.value*5)+parseInt(op7.value*0)+parseInt(op8.value*8.50)+parseInt(op9.value*3.75)+parseInt(op10.value*0)+parseInt(op11.value*10)+parseInt(op12.value*5)+parseInt(op13.value*3)+parseInt(op14.value*4)+parseInt(op15.value*2)+parseInt(op16.value*4)+parseInt(op17.value*5)+parseInt(op18.value*3)+parseInt(op19.value*5)+parseInt(op20.value*4)+parseInt(op21.value*3)+parseInt(op22.value*0)+parseInt(op23.value*1)+parseInt(op24.value*0)+parseInt(op25.value*0)+parseInt(op26.value*4)+parseInt(op27.value*2)-parseInt(op28.value); } </script> Good day! I am new in javascript function. I have Javascript code for auto calculate here is the code: Code: <script type="text/javascript" language="javascript"> function autocalearn(oText) { if (isNaN(oText.value)) //filter input { alert('Numbers only!'); oText.value = ''; } var field, val, oForm = oText.form, TotEarn = a = 0; for (a; a < arguments.length; ++a) //loop through text elements { field = arguments[a]; val = parseFloat(field.value); //get value if (!isNaN(val)) //number? { TotEarn += val; //accumulate } } var tot=Number(TotEarn) + Number(document.getElementById('Amount').value); oForm.TotEarn.value = tot.toFixed(2); //oForm.TotEarn.value = TotEarn.toFixed(2); //out } </script> <!--Total Deduction AutoCompute--> <script type="text/javascript" language="javascript"> function autocalded(oText) { if (isNaN(oText.value)) //filter input { alert('Numbers only!'); oText.value = ''; } var field, val, oForm = oText.form, TotalDed = a = 0; for (a; a < arguments.length; ++a) //loop through text elements { field = arguments[a]; val = parseFloat(field.value); //get value if (!isNaN(val)) //number? { TotalDed += val; //accumulate } } //oForm.TotalDed.value = TotalDed.toFixed(2); //out var totded=Number(TotalDed) + Number(document.getElementById('Deductions').value); oForm.TotalDed.value = totded.toFixed(2); } </script> and now my problem is...I have a textbox for the overall total, and i want it automatic subtract the total earn and total deduction.. I will attach my codes for further understanding. Thank you in advance First problem: I have a script that allows ONLY numbers to be typed into a text field. I have tried to modify this script to allow Decimals (periods) to be typed as well, but haven't succeeded. The code in Red are the changes I added to this script, but it isn't working out. Code: function numbersOnly(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 110 || charCode > 110) ) return false; return true; } Second Problem: I need to set a Minimum number users may type in the text field. Normally this would be a simple task, but the minimum number they may type is a decimal (0.10). The default value in the field is .50. I tried replacing the .50 with .09, and I can't get the field to run the script and set its new value to .10 (<- this is the minimum). Here is the code I am working with. Code: <?php $memberType = "free"; $creditsBalance = .5; $bannerBalance = 1000; $textBalance = 1000; ?> <html> <head> <title>Convert Credits</title> <style type="text/css"> #convert{ height: 10px; } </style> <script type="text/javascript" language="javascript"> function numbersOnly(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57) && (charCode < 110 || charCode > 110)) return false; return true; } function convert(){ creditsBanner = Number(document.convertform.creditsbanner.value); creditsText = Number(document.convertform.creditstext.value); bannerText = Number(document.convertform.bannertext.value); textBanner = Number(document.convertform.textbanner.value); memberType = "<?php echo $memberType;?>"; creditsBalance = "<?php echo $creditsBalance;?>"; bannerBalance = "<?php echo $bannerBalance;?>"; textBalance = "<?php echo $textBalance;?>"; if(memberType=="free"){ // If Free // check credit balance if(creditsBanner>creditsBalance){ document.convertform.creditsbanner.value = creditsBalance; creditsBanner = creditsBalance; if(creditsBanner<.1){ document.convertform.creditsbanner.value = 0.1; creditsBanner = 0.1; } } if(creditsText>creditsBalance){ document.convertform.creditstext.value = creditsBalance; creditsText = creditsBalance; if(creditsText<.05){ document.convertform.creditstext.value = 0.05; creditsText = 0.05; } } // check banner balance if(bannerText>bannerBalance){ document.convertform.bannertext.value = bannerBalance; bannerText = bannerBalance; if(bannerText<.5){ document.convertform.bannertext.value = .5; bannerText = .5; } } // check text balance if(textBanner>textBalance){ document.convertform.textbanner.value = textBalance; textBanner = textBalance; if(textBanner<2){ document.convertform.textbanner.value = 2; textBanner = 2; } } crBanner = Number(creditsBanner * 10); crText = Number(creditsText * 20); bnText = Number(bannerText * 2); txBanner = Number(textBanner / 2); document.getElementById("creditstobanner").innerHTML="<b>"+crBanner+"</b>"; document.getElementById("creditstotext").innerHTML="<b>"+crText+"</b>"; document.getElementById("bannertotext").innerHTML="<b>"+bnText+"</b>"; document.getElementById("texttobanner").innerHTML="<b>"+txBanner+"</b>"; } else{ // If Upgraded } } // function updateValues(val) { // document.getElementById('bannerimp').value = val * 10; // document.getElementById('field2').value = val * 20; // document.getElementById('field3').value = val / 2; // document.getElementById('field4').value = val * 2; // } //document.getElementById('creditstobanner').innerHTML </script> </head> <body> <h1>Convert Credits</h1><br /> Credits: <?php echo $creditsBalance; ?><br /> Banner Impressions: <?php echo $bannerBalance; ?><br /> Text Ad Impressions: <?php echo $textBalance; ?><br /> <form action="convert.php" method="POST" name="convertform"> <h2>Convert Your Credits to Banner or Text Ad Impressions</h2> <div id="convert">Convert <input type="text" name="creditsbanner" size="5" onKeyUp="convert();" onKeyPress="return numbersOnly(event);"> Credits to <span id="creditstobanner"><b>0</b></span> Banner Impressions!</div> <br /> <div id="convert">Convert <input type="text" name="creditstext" size="5" onKeyUp="convert();" onKeyPress="return numbersOnly(event);"> Credits to <span id="creditstotext"><b>0</b></span> Text Ad Impressions!</div><br /> <h2>Convert Your Impressions</h2> <div id="convert">Convert <input type="text" name="bannertext" size="5" onKeyUp="convert();" onKeyPress="return numbersOnly(event);"> Banner Impressions to <span id="bannertotext"><b>0</b></span> Text Ad Impressions!</div><br /> <div id="convert">Convert <input type="text" name="textbanner" size="5" onKeyUp="convert();" onKeyPress="return numbersOnly(event);"> Text Ad Impressions to <span id="texttobanner"><b>0</b></span> Banner Impressions!</div><br /> </form> </body> </html> Hi this is on my midterm review and I got the program down easily but I just wanted to know if there was an easy way of shortening down the answer to only 2 decimal places.possibly through division? Code: import java.util.*; public class StockSale { public static void main(String[] args) { Scanner input = new Scanner(System.in); double stockSale; // represent the stock sale price double commission; System.out.print("Please enter a the stock value price: "); stockSale = input.nextDouble(); if(stockSale < 100.00) commission = 20.00; else if (stockSale <= 999.99) commission = (20.00 + ((stockSale - 99.99)*.01)); else if (stockSale <= 9999.99) commission = (30.00 + ((stockSale - 999.99)*.005)); else if (stockSale <= 99999.99) commission = (75.00 + (( stockSale - 9999.99)*.0025)); else commission = ( 150.00 + ((stockSale - 99999.99)*.0015)); System.out.print("The commission on this stock sale is $" + commission ); } } i appreciate any help given thanks Hi all, I have a problem that has my brain turning to goo... I have a function that mixed with php adds the total numerical valus from different dropdowns. Code: <?php if($z == 1) { ?> <script type="text/javascript"><!-- function updatesum() { document.form.sum.value = <?php echo number_format($prodprice,2)?>+ <?php foreach(range('1',$matchcount2) as $i){?>(document.form.sublist<?php echo $i?>.options[document.form.sublist<?php echo $i?>.selectedIndex].id-0) + <?php }?> (document.form.sublist999.options[document.form.sublist999.selectedIndex].id-0.00); } //--></script> <?php }?> The total is then sent to an input field. Code: <div class="left product_text_box product_title">Total Price: <?php echo $currency_type?><input class="product_title" name="sum" readonly style="background:none; border:none" value="<?php echo number_format($prodprice,2)?>"></div> All works well, but the output allows too many decimals, ie: 46.8966666 I have tried to implement the toFixed(2) with only errors as my reward. Any help would be appreciated KF Hi, First time user of Javascript and built an online calculator, trouble is I dont know where or how to code it so the answer ends with only 2 decimals I have embedded code, help appreciated. Personally I think it's a miracle the darn thing works. Link to page it's on. Any help appreciated, I have searched and read but after hours of trying stuff gave up. <!-- function treevalue() { document.volume.result.value=(((3.14159*((document.volume.radius.value)*(document.volume.radius.valu e)))*(document.volume.height.value))/3)*(document.volume.base.value)*(document.volume.e.value)*(document.volume.fv.value)*(document.volum e.l.value); } // --> Thanks Eric How would I go about creating a random number between 1-50 that COULD include whole numbers, decimals to the tenth, hundredth and the thousandth place? Ex) 2.145, 3, 5.8, 41.002, 10.12, 7, 18.023, 33.2 Also, if the only way to do it is to put trailing zeros to the thousandth place that's fine as well ex) 2.145, 3.00, 5.800, 41.002, 10.120, 7.00, 18.023, 33.200 Dear Coders var amount1=12,345,678.10 var amount1=87,246,125.00 I want to sum amount1+amount2 as 99,591,803.10 Please help <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> Code: <script type='text/javascript'> <!-- function writeSummary() { var desiredquantity = document.orders.value; if (desiredquantity='') { alert('Please enter a value for the desired quantity'); return false; } else if (desiredquantity='value<0') { alert('Please enter a value for the desired quantity that is greater than 0'); return false; } else (desiredquantity='value>0') { alert('Thank you for your order!'); return true; } } //--> </script> </head> <body> <form name="Orders"; action=""; onSubmit="return writeSummary();"> <table width="80%" align="center"> <tbody> <tr> <td><<img SRC = "nwlogo.jpg" img align="right" style="width:200px; height:174px" height="174" width="200"></td> <td><big><b> 3-Season Tent</big></b></td> </tr> </tbody> </table> <p> <table width="80%" border="5" cellspacing="3" cellpadding="5" align="center"> <tbody> <tr> <th width="20%">Selection</th> <th width="20%">Size</th> <th width="20%">Color</th> <th width="20%">Price</th> <th width="20%">In Stock?</th> </tr> <tr> <td align="middle"></td> <td align="middle">Rectangular</td> <td align="middle">Blue</td> <td align="middle">259.99</td> <td align="middle">Yes</td> </tr> </tbody> </table> </p> <p> <table width="80%" cellspacing="3" cellpadding="5" align="center"> <tbody> <tr> <td width="70%"><big>Desired Quantity</big><input type="text" name="userid" size="20"></td> <td align="right" width="15%"><input type="button" name="subbtn" value="Submit"/></td> </tr> </tbody> </table> </p> <p> <table width="80%" align="center" border="" id="Table1"> <tbody> <tr> <td align="right">Subtotal: <input type="text" name="userid" size="20"></td> <td></td> </tr> <tr> <td align="right">Tax: <input type="text" name="userid" size="20"></td> <td></td> </tr> <tr> <td align="right">Order Total: <input type="text" name="userid" size="20"></td> <td></td> </tr> </tbody> </table> </p> </form> </body> </html> Need help with the javascript coding portin of the web page. Need it to use the pop up alerts that have been input above and also to calculate the order upon entering a correct amount showing subtotal, tax, and total. I currently have a script setup in HTML that will allow me too input a "Customers ID" and their "Gas Usage". Once those are entered, it will do some calculations and display text stating: > "Customers ID: 1 has gas usage of 50 and owes $100 > > Customers ID: 2 has gas usage of 120 and owes $195 > > Customers ID: 3 has gas usage of 85 and owes $142.5 > > Customers ID: 4 has gas usage of 65 and owes $112.5 > > Total amount of customers is: > > Total amount owed all customers:" **What im having trouble** with is making a running total that will calculate the "Total amount of customers" and the "Total amount owed by customers". All I know is that I may need to add another variable in the script. Code: function Summarise() { ID = prompt("Enter a Customer ID number ", -1) while(ID != -1) { var gasUsed = 0 gasUsed = prompt("Enter amount of gas used ", "0") var total = 0 ///Standard Rate is used to assist in the calculation of customers in excess of 60 Gas Used StandardRate = 60 * 1.75 if(gasUsed <= 60) { total= gasUsed * 2 document.write("Customers ID: " + ID) document.write(" has gas usage of " + gasUsed) document.write(" and owes $" + total) document.write("<br/>") } else { total= (gasUsed - 60) * 1.50 + StandardRate document.write("Customers ID: " + ID) document.write(" has gas usage of " + gasUsed) document.write(" and owes $" + total) document.write("<br/>") } ID = prompt("Enter a Customer ID number ", -1) } } I looked around for a solution but could not find one. I am trying to find combinations of numbers that can add up to a total. The numbers available and the total are different each time. For example, I have an array that contains the following numbers: [16,12,8,6,4,2] I want to find the combinations that add up to 140, like this: 8x16,1x12 8x16,1x8,1x4 11x12,1x8 Notice I do not do: 8x16,2x6 8x16,3x4 This is because as a rule, only the first number can be used in multiple of more than one. All other number pairs can only be a 1x. Output string could be formatted like this in a single string containing all combinations: 8x16,1x12|8x16,1x8,1x4|11x12,1x8 I'm creating a web form that allows users to select from a list, choose a quantity and have the total for that quantity calculated, but when I run the html, I get Nan in the total price box. The problem starts with the calc price function. I've tried eval(), parseFloat to change the text to a number, but I think I'm putting the code in the wrong place. I would greatly appreciate any input I can get -- thanks in advance! The first part is the javascript code (I have linked in a separate file) with the html below it. Code: window.onload = startForm; function todayTxt() { var Today = new Date(); return Today.getMonth() + 1 + "-" + Today.getDate() + "-" + Today.getFullYear(); } function startForm(){ document.forms[0].date.value = todayTxt(); document.forms[0].prod.focus(); document.forms[0].prod.onchange = calcPrice; document.forms[0].qty.onchange = calcPrice; for (var i=0; i<document.forms[0].shipType.length; i++) { document.forms[0].shipType[i].onclick = calcShipping; } } function calcPrice() { product=document.forms[0].prod; pIndex=product.selectedIndex; productPrice=product.options[pIndex].value; //returns the price of the selected product quantity=document.forms[0].qty; qIndex=quantity.selectedIndex; quantityOrdered=quantity.options[qIndex].value; //returns the index of the selected quantity document.forms[0].price.value = eval(product.Price*quantityOrdered); //cost is equal to product price multiplied by quantity ordered } function calcShipping() { document.forms[0].ship.value = this.value;} function calcTotal() { priceVal=parseFloat(document.forms[0].price.value); shipVal=parseFloat(document.forms[0].ship.value); document.forms[0].sub.value = priceVal + shipVal; taxVal = 0.05*(priceVal + shipVal); document.forms[0].tax.value = taxVal; document.forms[0].tot.value = priceVal + shipVal + taxVal; } <html> <body> <form id="form1" method="post" action="form2.htm"> <div id="links"> <a href="#" class="newgroup">Home Page</a> <a href="#">Product Catalog</a> <a href="#">Order Form</a> <a href="#">Maps Online</a> <a href="#">Contact Us</a> <a href="#" class="newgroup">Countries</a> <a href="#">States</a> <a href="#">National Parks</a> <a href="#">Hiking Trails</a> <a href="#">Cities</a> <a href="#">Astronomical</a> <a href="#">Natural</a> <a href="#" class="newgroup">GoMap 1.0</a> <a href="#">Drive Planner 2.0</a> <a href="#">Hiker 1.0</a> <a href="#">G-Receiver I</a> <a href="#">G-Receiver II</a> <a href="#">G-Receiver III</a> <a href="#" class="newgroup">Downloads</a> <a href="#">Tech Support</a> <a href="#">FAQs</a> </div> <div id="main"> <p id="logo"><img src="gpsware.jpg" alt="GPS-ware" /></p> <h1>Order Form</h1> <p id="datep"> <input class="text" id="date" name="date" size="11" value="mm-dd-yyyy" readonly="readonly" /> </p> <fieldset> <legend>Select a Product</legend> <table> <tr> <td class="labelcell">Product</td> <td class="inputcell"> <select name="prod" id="prod"> <option value="0">Products from GPS-ware</option> <option value="19.95">GoMap 1.0 ($19.95)</option> <option value="29.95">Drive Planner 2.0 ($29.95)</option> <option value="29.95">Hiker 1.0 ($29.95)</option> <option value="149.50">G-Receiver I ($149.50)</option> <option value="199.50">G-Receiver II ($199.50)</option> <option value="249.50">G-Receiver III ($249.50)</option> </select> <select name="qty" id="qty"> <option value="0">Quantity</option> <option value="1">1</option><option value="2">2</option><option value="3">3</option> <option value="4">4</option><option value="5">5</option><option value="6">6</option> <option value="7">7</option><option value="8">8</option><option value="9">9</option> <option value="10">10</option> </select> </td> <td class="outcell"> <input class="num" name="price" id="price" size="7" value="0.00" readonly="readonly" /> </td> </tr> <tr> <td class="labelcell">Shipping</td> <td> <p><input type="radio" name="shipType" id="ship1" value="4.95" /> <label for="ship1">Standard (4-6 business days): $4.95</label> </p> <p><input type="radio" name="shipType" id="ship2" value="8.95" /> <label for="ship2">Express (2 days): $8.95</label> </p> <p><input type="radio" name="shipType" id="ship3" value="12.95" /> <label for="ship3">Next Day (1 day): $12.95</label> </p> </td> <td class="outcell"> <input class="num" name="ship" id="ship" size="7" value="0.00" readonly="readonly" /> </td> </tr> <tr> <td colspan="2" class="labelcell2">Subtotal</td> <td class="outcell"> <input class="num" name="sub" size="7" value="0.00" readonly="readonly" /> </td> </tr> <tr> <td colspan="2" class="labelcell2">Tax (5%)</td> <td class="outcell"> <input class="num" name="tax" id="tax" size="7" value="0.00" readonly="readonly" /> </td> </tr> <tr> <td colspan="2" class="labelcell2">TOTAL</td> <td class="outcell"> <input class="num" name="tot" id="tot" size="7" value="0.00" readonly="readonly" /> </td> </tr> </table> </fieldset> <p id="formbuttons"> <input type="reset" name="cancelb" id="cancelb" value="Cancel" /> <input type="submit" name="nextb" id="nextb" value="Next" /> </p> </div> </form> </body> </html> Hello guys, I'm having some problems with jquery.. What I'm trying to do is, a jquery script to show in real time the total price. I got this: Code: <li>Users</li> <li> <select name="users" id="users"> <option value='1'>1</option> <option value='2'>2</option> <option value='3'>3</option> <option value='4'>4</option> <option value='5'>5</option> <option value='6'>6</option> <option value='7'>7</option> <option value='8'>8</option> <option value='9'>9</option> <option value='10'>10</option> </select> </li> <li>Months</li> <li> <select name="months" id="months"> <option value='1'>1 Month</option> <option value='2'>2 Months</option> <option value='3'>3 Months</option> <option value='4'>4 Months</option> <option value='5'>5 Months</option> <option value='6'>6 Months</option> <option value='7'>7 Months</option> <option value='8'>8 Months </option> <option value='9'>9 Months</option> <option value='10'>10 Months</option> <option value="11">11 Months</option> <option value="12">12 Months</option> </select> </li> <div class="grand_total"> <h4 class="colr">Price</h4> <ul> <li class="price">$0.50</li> </ul> </div> 1 Month and 1 User price should be 0.50 USD +1 Month = + 0.50 USD + 1 User = + 0.50 USD Example: 5 Users + 2 Months = 3.50 USD I wanna make the jquery to show the total price at li class="price" Sorry, I'm newbie at jquery. Anyone could help me please? Thank you. Hi, I am new here and am hoping for some guidance or a solution. Any help is greatly appreciated. I have a total count in a shopping cart stored from PHP as a cookie. I.E. compare[233], compare[324] (where the id is the item ID). I want to update the count of items in the cart in real time, so when the visitor clicks "Add", the count will update without reloading the page. Currently, I can get PHP to count the cookies, but not JS. The problem that I am having is that if the items are 7, and an item is added it will go to 8 correctly, if another item is added it goes to 14, not 9. This is the code that I have so far: Code: <?php $saved_ct = $number_of_items_already_in_cart; // # of cookies found or 'compare' I.E. 7 ?> <script type="text/javascript"> function increase(){ var i=<?php echo "$saved_ct"; ?>; i++; document.getElementById('i').innerHTML= + i; } </script> Cart: (<b id=\"saved_ct\">{$saved_ct}</b>) --- Item: <a href=\"#\" id=\"{$id}\" onclick=\"increase();return false\">Add to basket</a> Hi, I admit from the start, I'm not very good with JS, I've used it a few times over the years, but mostly readymade scripts that I can just link to a website and use. Anyway, I need something somewhat specific and I don't know where to find such a code or even if I can modify the one I have found to do what I need. What I need is to be able to update totals on the page as things are changed, but I'm not talking about one total. What I have is a list of spare parts with a quantity box next to them, when someone changes the quatity the price for that part needs to update as well as the total price AND a sum that is an allocated amount minus the total (so they can see how much of their allocation they have left). So far, all I've managed to find is a script that will update just the final total (http://www.mcfedries.com/JavaScript/OrderTotals.asp), but as you can see, that's not that helpful. I've sat and stared at the code and while I can say what things do what, I wouldn't know where to start in changing it. Hope someone can help! Thanks Form cap: http://img38.imageshack.us/img38/8118/partlist.png Quote: The parameter A should display the sum of the remaining six fields. I did try adding that using the JAVA script that is mentioned in second code. The total should be display immediately after value is set for any of the text boxes. The text box gets the value using drop down menu. This procedure only works if I use the keyboard tab. If I use the mouse to select YES and No, then it will not display the total Code: <html> <head> <script type="text/javascript" src="javascript/addfunctions.js"></script> <script type="text/javascript"> function enable1() { document.audit_billing_IE.Para_A_A1_comment.disabled = false; document.audit_billing_IE.Para_A_A1_score.value = 00; } function enable2() { document.audit_billing_IE.Para_A_A2_comment.disabled = false; document.audit_billing_IE.Para_A_A2_score.value = 00; } function enable3() { document.audit_billing_IE.Para_A_A3_comment.disabled = false; document.audit_billing_IE.Para_A_A3_score.value = 00; } function enable4() { document.audit_billing_IE.Para_A_A4_comment.disabled = false; document.audit_billing_IE.Para_A_A4_score.value = 00; } function enable5() { document.audit_billing_IE.Para_A_A5_comment.disabled = false; document.audit_billing_IE.Para_A_A5_score.value = 00; } function enable6() { document.audit_billing_IE.Para_A_A6_comment.disabled = false; document.audit_billing_IE.Para_A_A6_score.value = 00; } function disable1() { document.audit_billing_IE.Para_A_A1_comment.disabled = true; document.audit_billing_IE.Para_A_A1_score.value = 10; } function disable2() { document.audit_billing_IE.Para_A_A2_comment.disabled = true; document.audit_billing_IE.Para_A_A2_score.value = 10; } function disable3() { document.audit_billing_IE.Para_A_A3_comment.disabled = true; document.audit_billing_IE.Para_A_A3_score.value = 10; } function disable4() { document.audit_billing_IE.Para_A_A4_comment.disabled = true; document.audit_billing_IE.Para_A_A4_score.value = 10; } function disable5() { document.audit_billing_IE.Para_A_A5_comment.disabled = true; document.audit_billing_IE.Para_A_A5_score.value = 10; } function disable6() { document.audit_billing_IE.Para_A_A6_comment.disabled = true; document.audit_billing_IE.Para_A_A6_score.value = 10; } function na1() { document.audit_billing_IE.Para_A_A1_comment.disabled = true; document.audit_billing_IE.Para_A_A1_score.value = 00; } function na2() { document.audit_billing_IE.Para_A_A2_comment.disabled = true; document.audit_billing_IE.Para_A_A2_score.value = 00; } function na3() { document.audit_billing_IE.Para_A_A3_comment.disabled = true; document.audit_billing_IE.Para_A_A3_score.value = 00; } function na4() { document.audit_billing_IE.Para_A_A4_comment.disabled = true; document.audit_billing_IE.Para_A_A4_score.value = 00; } function na5() { document.audit_billing_IE.Para_A_A5_comment.disabled = true; document.audit_billing_IE.Para_A_A5_score.value = 00; } function na6() { document.audit_billing_IE.Para_A_A6_comment.disabled = true; document.audit_billing_IE.Para_A_A6_score.value = 00; } function changed1(el) { var sel = el.options[el.selectedIndex]; if (sel.value == "Yes")disable1(); if (sel.value == "No")enable1(); if (sel.value == "Na")na1(); } function changed2(el) { var sel = el.options[el.selectedIndex]; if (sel.value == "Yes")disable2(); if (sel.value == "No")enable2(); if (sel.value == "Na")na2(); } function changed3(el) { var sel = el.options[el.selectedIndex]; if (sel.value == "Yes")disable3(); if (sel.value == "No")enable3(); if (sel.value == "Na")na3(); } function changed4(el) { var sel = el.options[el.selectedIndex]; if (sel.value == "Yes")disable4(); if (sel.value == "No")enable4(); if (sel.value == "Na")na4(); } function changed5(el) { var sel = el.options[el.selectedIndex]; if (sel.value == "Yes")disable5(); if (sel.value == "No")enable5(); if (sel.value == "Na")na5(); } function changed6(el) { var sel = el.options[el.selectedIndex]; if (sel.value == "Yes")disable6(); if (sel.value == "No")enable6(); if (sel.value == "Na")na6(); } </script> </head> <body> <form name="audit_billing_IE" method="POST" action="billing.php"> <table> <tr> <td> Parameter A </td> <td colspan='3'> <input type="text" name="product_name4" id="product_name4" /> </td> </tr> <tr> <td> Procedure </td> <td> <select name="Para_A_A1" id = "Para_A_A1" align="center" onchange="changed1(this)"> <option value="s1"> Select</option> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="Na"> Na </option> </select> </td> <td> <input type="text" name="Para_A_A1_comment" value="" disabled/> </td> <td align="center"> <input type="text" name="Para_A_A1_score" value="" onFocus="startCalc();" onBlur="stopCalc();"/> </td> </tr> <tr> <td> Days Calculation </td> <td> <select name="Para_A_A2" id = "Para_A_A2" align="center" onchange="changed2(this)"> <option value="s2"> Select</option> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="Na"> Na </option> </select> </td> <td > <input type="text" name="Para_A_A2_comment" value="" disabled/> </td> <td> <input type="text" name="Para_A_A2_score" id="Para_A_A2_score" value="" onFocus="startCalc();" onBlur="stopCalc();"/> </td> </tr> <tr> <td> request form </td> <td> <select name="Para_A_A3" align="center" onchange="changed3(this)"> <option value="s3"> Select</option> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="Na"> Na </option> </select> </td> <td > <input type="text" name="Para_A_A3_comment" value="" disabled/> </td> <td> <input type="text" name="Para_A_A3_score" id="Para_A_A3_score" value="" onFocus="startCalc();" onBlur="stopCalc();" /> </td> </tr> <tr> <td> Case </td> <td> <select name="Para_A_A4" align="center" onchange="changed4(this)"> <option value="s4"> Select</option> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="Na"> Na </option> </select> </td> <td > <input type="text" name="Para_A_A4_comment" value="" disabled/> </td> <td> <input type="text" name="Para_A_A4_score" id="Para_A_A4_score" value="" onFocus="startCalc();" onBlur="stopCalc();"/> </td> </tr> <tr> <td> interaction </td> <td> <select name="Para_A_A5" align="center" onchange="changed5(this)"> <option value="s5"> Select</option> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="Na"> Na </option> </select> </td> <td > <input type="text" name="Para_A_A5_comment" value="" disabled/> </td> <td> <input type="text" name="Para_A_A5_score" id="Para_A_A5_score" value="" onFocus="startCalc();" onBlur="stopCalc();"/> </td> </tr> <tr> <td> MIS</td> <td> <select name="Para_A_A6" align="center" onchange="changed6(this)"> <option value="s6"> Select</option> <option value="Yes"> Yes </option> <option value="No"> No </option> <option value="Na"> Na </option> </select> </td> <td > <input type="text" name="Para_A_A6_comment" value="" disabled/> </td> <td> <input type="text" name="Para_A_A6_score" id="Para_A_A6_score" value="" onFocus="startCalc();" onBlur="stopCalc();"/> </td> </tr> </table> </form> </body> </html> Code: function startCalc(){ interval = setInterval("calc()",1); } function calc(){ one = document.audit_billing_IE.Para_A_A1_score.value; two = document.audit_billing_IE.Para_A_A2_score.value; three = document.audit_billing_IE.Para_A_A3_score.value; four = document.audit_billing_IE.Para_A_A4_score.value; five = document.audit_billing_IE.Para_A_A5_score.value; six = document.audit_billing_IE.Para_A_A6_score.value; document.audit_billing_IE.product_name4.value = [(one * 1) + (two * 1) + (three * 1) + (four * 1) + (five * 1) + (six * 1)]; } function stopCalc(){ clearInterval(interval); } Hi All, I need help on how to subtract totalgift if my condition of donateamount is lesser than the totalgift trigger. When the field is selected and the DonateAmount is trigger, I need to subtract the entered amount on the field selected to the TotalGift and put the field selected to zero "0" and TotalGift to original amount which is less than the amount entered on the field selected. I have some code that I created but it doesn't work. My initial javascript to calculate all the total is below assuming that DonateAmount is already selected = 25: Code: /* this function works fine with the set of code*/ function CalculateTotal(donate_amount_other) { var tota = document.getElementById('a').value; var totb = document.getElementById('b').value; var totc = document.getElementById('c').value; var totd = document.getElementById('d').value; var tote = document.getElementById('e').value; var totf = document.getElementById('f').value; var totg = document.getElementById('g').value; var toth = document.getElementById('h').value; var toti = document.getElementById('i').value; var totj = document.getElementById('j').value; var totk = document.getElementById('k').value; var totl = document.getElementById('l').value; var totm = document.getElementById('m').value; var totn = document.getElementById('n').value; var toto = document.getElementById('o').value; var totp = document.getElementById('p').value; var totq = document.getElementById('q').value; var totr = document.getElementById('r').value; var TotC = document.getElementById('TotalC').value; TotC = Number(tota) + Number(totb) + Number(totc) + Number(totd) + Number(tote) + Number(totf) + Number(totg) + Number(toth) + Number(toti) + Number(totj) + Number(totk) + Number(totl) + Number(totm) + Number(totn) + Number(toto) + Number(totp) + Number(totq) + Number(totr); document.getElementById('TotalC').value = TotC.toFixed(2); if (isNaN(TotC)) { // if grandTotal is not a number alert ("You must enter numbers 0-9 only in the boxes"); document.getElementById('TotalC').value = "ERROR"; // or perhaps value = "ERROR!" return false; } /* the condition below triggers only when the toti - totr fields are entered less than 48 but still need to subtract the total if TotalGift is greater than DonateAmount given */ if (toti >0 && toti <48 ) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('i').value = "0"; // or perhaps value = "ERROR!" return false; } if (totj >0 && totj <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('j').value = "0"; // or perhaps value = "ERROR!" return false; } if (totk >0 && totk <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('k').value = "0"; // or perhaps value = "ERROR!" return false; } if (totl >0 && totl <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('l').value = "0"; // or perhaps value = "ERROR!" return false; } if (totm >0 && totm <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('m').value = "0"; // or perhaps value = "ERROR!" return false; } if (totn >0 && totn <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('n').value = "0"; // or perhaps value = "ERROR!" return false; } if (toto >0 && toto <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('o').value = "0"; // or perhaps value = "ERROR!" return false; } if (totp >0 && totp <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('p').value = "0"; // or perhaps value = "ERROR!" return false; } if (totq >0 && totq <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('q').value = "0"; // or perhaps value = "ERROR!" return false; } if (totr >0 && totr <48) { alert ("All donations in this section must be $48 minimum (processing fee may apply) - please revise your entry to avoid any processing errors"); document.getElementById('r').value = "0"; // or perhaps value = "ERROR!" return false; } /* The code below works if I only check the TotalGift is greater than DonateAmount but will cannot do subtraction to the TotalGift and the entered amount. */ if ((DonateText < TotC)) { alert('Your total designated amount of $' + TotC + ' is more than your donation amount of $' + DonateText + '. Please revise your entry to avoid any processing errors.'); //add if here for all fields focus document.getElementById('TotalC').value = TotC; // or perhaps value = "ERROR!" document.getElementById('TotalC').focus(); return false; } } Below is what I am trying to do but it doesn't work. If the first input field is selected and user enter amount greater than the TotalGift, alert will pop-up then and the amount entered by the user automatically added to the TotalGift. So what I wanted to do is to subtract the amount entered to the TotalGift so it will go back to the original amount before the addition occurs. I know it is possible but I just can't get the right code. Can you please help? I need to make this done as soon as possible, please!!!!! Code: if ((DonateText < TotC) && (document.getElementById('a').value)) { alert('Your total designated amount of $' + TotC + ' is more than your donation amount of $' + DonateText + '. Please revise your entry to avoid any processing errors.'); //add if here for all fields focus if (TotC = "0.00") { document.getElementById('a').value=0; document.getElementById('TotalC').value = TotC; // or perhaps value = "ERROR!" } else { TotC = TotC - document.getElementById('a').value; document.getElementById('tota').value = "0"; document.getElementById('TotalC').value = TotC; // or perhaps value = "ERROR!" document.getElementById('TotalC').focus(); return false; } } if ((DonateText < TotC) && (document.getElementById('b').value)) { alert('Your total designated amount of $' + TotC + ' is more than your donation amount of $' + DonateText + '. Please revise your entry to avoid any processing errors.'); if (TotC = "0.00") { document.getElementById('b').value=0; document.getElementById('TotalC').value = TotC; // or perhaps value = "ERROR!" } else { TotC = TotC - document.getElementById('b').value; document.getElementById('totb').value = "0"; document.getElementById('TotalC').value = TotC; // or perhaps value = "ERROR!" document.getElementById('TotalC').focus(); return false; } } /* so on My html code below which I have 18 input fields but all of them only optional wherever the user wants to input number. I will only include some here. Code below works, please ignore any missing code. I just need the calculation code to work. PHP Code: <label>Donation Amount: $</label> <input name="TotalDonate" id="TotalDonate" type="text" maxlength="10" readonly="true" onClick="CalculateTotal(this.value,99);" /> <label for="agencysupport" style="font-weight:bold">C. Agency/Program Support ($48 MINIMUM PER CHOICE)</label> <BR /> <p style="color:#000000">My gift is designated to one or more specific agencies or programs. Processing fee may apply. </p> <p style="color:#FF0000">(Note: Some Agency Names may be indented on the next line due to space allowed. Choosing either one of the Agency Names will give you the same code.)</p> <table> <tr> <td> <select id="designation_list1" name="designation_list1" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list1']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="i" name="i" class="text" type="text" value="<?php safeEcho($form['i'])?>" style="width:90px;" onChange="CalculateTotal()"/> <?php helper_error('i');?> </td> </tr> <tr> <td> <select id="designation_list2" name="designation_list2" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list2']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="j" name="j" class="text" type="text" value="<?php safeEcho($form['j'])?>" style="width:90px;" onChange="CalculateTotal()"/> <?php helper_error('j');?> </td> </tr> <tr> <td> <select id="designation_list3" name="designation_list3" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list3']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="k" name="k" class="text" type="text" value="<?php safeEcho($form['k'])?>" style="width:90px;" onChange="CalculateTotal()"/> <?php helper_error('k');?> </td> </tr> <tr> <td> <select id="designation_list4" name="designation_list4" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list4']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="l" name="l" class="text" type="text" value="<?php safeEcho ($form['l'])?>" style="width:90px;" onChange="CalculateTotal()"/> <?php helper_error('l');?> </td> </tr> <tr> <td> <select id="designation_list5" name="designation_list5" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list5']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="m" name="m" class="text" type="text" value="<?php safeEcho($form['m'])?>" style="width:90px;" onChange="CalculateTotal();"/> <?php helper_error('m');?> </td> </tr> <tr> <td> <select id="designation_list6" name="designation_list6" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list6']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="n" name="n" class="text" type="text" value="<?php safeEcho($form['n'])?>" style="width:90px;" onChange="CalculateTotal();"/> <?php helper_error('n');?> </td> </tr> <tr> <td> <select id="designation_list7" name="designation_list7" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list7']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="o" name="o" class="text" type="text" value="<?php safeEcho($form['o'])?>" style="width:90px;" onChange="CalculateTotal();"/> <?php helper_error('o');?> </td> </tr> <tr> <td> <select id="designation_list8" name="designation_list8" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list8']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="p" name="p" class="text" type="text" value="<?php safeEcho($form['p'])?>" style="width:90px;" onChange="CalculateTotal();"/> <?php helper_error('p');?> </td> </tr> <tr> <td> <select id="designation_list9" name="designation_list9" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list9']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="q" name="q" class="text" type="text" value="<?php safeEcho($form['q'])?>" style="width:90px;" onChange="CalculateTotal();"/> <?php helper_error('q');?> </td> </tr> <tr> <td> <select id="designation_list10" name="designation_list10" size="1" style="overflow-x:scroll; width:380px; "> <option>Click to select...</option> <?php foreach ($designation_list as $descode => $prompt) : ?> <option <?php echo helper_selected($descode == $form['designation_list10']); ?> value="<?php echo $prompt; ?>" ><?php safeEcho($descode); ?> </option> <?php endforeach; ?> </select> </td> <td> $<input id="r" name="r" class="text" type="text" value="<?php safeEcho($form['r'])?>" style="width:90px;" onChange="CalculateTotal();"/> <?php helper_error('r');?> </td> </tr> <tr> <td style="text-align:right; font-size:14px"><b>TOTAL GIFT(S) DESIGNATED (A-C)</b><BR /> (Must not exceed donation amount)</td> <td>$<input name="TotalC" id="TotalC" type="text" maxlength="10" value="<?php echo $TotalC; ?>" readonly="true" onChange="CalculateTotal(this.value,99);" style="width:90px" /></td> </tr> </table> Please, I really need to make this work today. Hope you can help me please!!!! Thanks in advance. Hi, I would like to display total online viewers on my website, how can i do this? thanks |