HTML - Rounding Issue On Html Calculator
Hi,
I'm rather new to website building and this site so my apologies if I'm posting in the wrong area. I've built my first website and have obtained html code for a simple quantity X price calculator to put on my website. The problem is with some quantities entered the prices shows out to 7 or so decimal places. This should be a dollar amount so only 2 decimal places are needed. The website link is http://www.essaycorrect.com/index.php/prices/ and for example 789 words entered in top box comes back with price of 23.6699999. The coding is below. Any help would be very, very appreciated. Thanks, Tim. <script language="JavaScript"> <!-- function CalculateTotals(){ f=document.orderform; f.total1.value=parseInt(f.qty1.value)*.03; f.total2.value=parseInt(f.qty2.value)*.05; f.total3.value=parseInt(f.qty3.value)*.03; f.total4.value=parseInt(f.qty4.value)*.05; f.grandtotal.value=parseInt(f.total1.value) +parseInt(f.total2.value) +parseInt(f.total3.value) +parseInt(f.total4.value) +parseInt(f.sh.value);} //--> </script></head> <body> <form name="orderform" method="post" action="formprocessor"> <table border="3"><tr> <th>Word count</th><th>Service</th><th>Time</th> <th>Price per word</th><th>Price(A$)</th></tr> <tr><td> <input name="qty1" size="10" OnBlur="CalculateTotals()" /></td> <td>Standard</td><td>Below 5000 words=3days / Above 5000 words=7days </td> <td align="right">3 cents </td> <td><input name="total1" size="6" OnFocus="document.orderform.qty2.select(); document.orderform.qty2.focus();" /></td></tr> <tr><td> <input name="qty2" size="10" OnBlur="CalculateTotals()" /></td> <td>Express</td><td>Below 5000 words=1day / Above 5000 words=3days </td> <td align="right">5 cents </td> <td><input name="total2" size="6" OnFocus="document.orderform.qty3.select(); document.orderform.qty3.focus();" /></td></tr> </table> <input type="hidden" value="0" name="sh" /> </form> <script language="JavaScript"> <!-- f=document.orderform; f.qty1.value=0; f.qty2.value=0; f.qty3.value=0; f.qty4.value=0; f.total1.value=0; f.total2.value=0; f.total3.value=0; f.total4.value=0; f.sh.value=0; f.grandtotal.value=0; f.grandtotal.value=0; //--> </script> </body></html> Similar TutorialsHello all, New member here im trying to make an HTML calculator with 2 boxes 1 box is for Kills i get in a video game 2nd box for deaths i have a video game where my leaderboard kills a 90488 kills, and i have 54933 deaths, so my kill to death ratio is 1.647243 which is basically 1.65 and in order to get to 1.66 kill to death ratio i need 476 kills how can i write this script? im new to html Im setting up a website that needs to have a calculator similiar to this link: https://www.101incorporate.com/incorporation-order.htm The user need to be able to click on things and the calculator need to change according to the different packages and items they select. And the calculator will total it out. Can anyone help me? Please. Thanks! I need to make a calculator for a website. The user would have a couple of inputs, which would run through a formula, and have an output. I don't know where to start. You'd think there would be tutorials for something as simple as this sounds. Your help is appreciated. hi: this sort of fits in the php forum, but seems to fit better here. I am using php includes on a customers website. For some reason, the pictures are not aligning as they should. If i open the php file by itself, everything is aligned. When it loads in the index.php file as an include, it all goes astray... I've tried div align=left, aligns everthing to the left if i open the page by itself, but included in index.php it's all unorganized. check it out here and let me know what to do, i am in a real pickle here!!! http://www.tegbs.com Alright you know how you could make 1 css different for IE then FF. well thats what i want to know is it possible to have a different HTML for IE and FF? Ive been searching all day.. Hello all! I'm getting this really weird HTML issue when opening my webpage on IE 9. You can visualize it he www.brancodemiranda.adv.br On Chrome it has no problems, but on IE I get two weird things: - I get another "main box" right below the correct one - The idiom bar div is messed up aswell Both showed up after I inserted the DOCTYPE tag (which I did to solve the IE-ignoring-hover problem), I've corrected a few compatibility errors already, but I'm kinda stuck on these. And since I don't have much time to go deep on solving it, I guess that someone here could give me some pointers on how to solve this. Any help is greatly appreciated! Thanks! Hey, just getting back into web dev (after a long time and little time spent) My page has a container DIV, inside is a header DIV "idHeader", a main DIV "idBody", and a footer DIV "idFooter". I want the the height of both the header and the footer to be static, but the main DIV to stretch dynamically based on content (I have the footer DIV set to relative positioning, so it should move.. right?) I don't know what I've left out though, because my text overflows from the main under the footer and down the page. I imagine I've just missed something key. Here's the code, the colors are funny for observation. Code: <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> *{ font:Arial, Helvetica, sans-serif; font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:0px; } body{ background-color:#000000; } #idContainer{ background-color:#FFFFFF; position:absolute; left:50px; width:800px; height:100%; } #idHeader{ position:relative; width:800px; height:100px; background-color:#FF0000; } #idBody{ position:relative; overflow:visible; width:800px; height:100%; background-color:#0000FF; } #idFooter{ position:relative; width:800px; height:200px; background-color:#00FF00; } </style> </head> <body> <div id="idContainer"> <div id="idHeader"> </div> <div id="idBody"> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> <p>This is a paragraph. What a nice paragraph.</p> </div> <div id="idFooter"> </div> </div> </body> </html> So I haven't done a site in some time, but I still got the very basic basics memorized. To guide me through my born-again virginity I tried a pre-built free web site. Everything was working great. I'd preview through Dreamweaver and the very basic site looked just fine. I now upload the site to the world wide web and parts of the HTML/CSS are not translating properly (in fact there are parts missing that should be there???). The first problem occurs in the section of the CSS called "PAGE". "Page" has a repeater called "img04" and "Page .bgtop" non-repeater called "img03_blue". "page . bgtop - img_03..." doesn't show up - but in preview it did. Any ideas on what's going on? Second, in the area tagged "MENU A" in the CSS the static background image called "img07_blue" doesn't show - again, in the preview it did, now nothing on the web. I assume its a similar issue to issue 1, but I don't know? This is for a web site my wife needs so any help would be greatly appreciated. I have attached the site for reference. Thanks, J I have built a site for a friend using squarespace. They asked me to add this code to the site but it won't display correctly. Can anyone help? Thanks! http://www.thegalleryevents.com/about/ - here is the page I am trying to add it to. You can clearly see the purple line through it is wrong. <link href="http://assets1.onewed.com/edgy/themes/onewed/banner.v3.css" rel="stylesheet" type="text/css" /> <div class="onewed"><div id="banner1"><div class="vendortxt"><h2> The Gallery - An Event Boutique</h2><p> Desire Wedding Planners / Consultants? The Gallery - An Event Boutique is the best choice. Visit The Gallery - An Event Boutique at OneWed.com & create a <a href="http://www.onewed.com/reviews/wedding-planners-wedding-consultants/texas/tx/dallas/the-gallery---an-event-boutique/1927387/">wedding vendor review</a>. </p><p>Keeping track of all your wedding is fun with OneWed's <a href="http://www.onewed.com/apps/wedding-checklist/">wedding timeline</a>. Devise, edit and delegate tasks from picking a caterer to buying wedding lingerie. </p></div><div class="footer"> </div></div></div> For some reason, using <table align="center" width="85%"> at the following http://amazingfreegraphics.com/webfetti.html correctly shows the content in 85% of the browser in Internet Explorer, but still covers 100% in Mozilla. How do I fix in Mozilla? hi, i tried looking through forums but couldnt find an answer. i hope u can please help! i have a photography ad up on a site that i use html for, its simply a block of code hosting a list/tall page of pics, one line/pic goes like this... <img src="http://img715.imageshack.us/img715/3126/img7899small.jpg"><br> the other lines in the text are the same code. problem is they all try to load up simultaneously causing a slow ad to see anything, potentially losing observers attention span. do u know if theres some code i can add to each line so each pic loads up fully before the next one begins to load and this starts at the top? this will help keep attention due to somin at the top loading straight away, thanks! Hi, I am trying to create a form that emails me a copy of the form results (if possible in a pretty format) and then redirects the user to another page. I don't want the user to use a .php or .asp page if possible, I would prefer to keep the user on a .html page. If its possible for the form to use an external page or code that the user never sees then this is fine. Cheers! Sam Hey everyone. I've sliced this psd, and uploaded all the images to a server, used border="0". When I view the html file standalone in a browser, it appears fine. When I go to insert it into my email program, the different slices at the bottom are all spaced out in weird configurations, and I cannot for the life of me figure out how to change this. I'm only a couple months in to html, so please excuse my ignorance if this is a simple fix. It's images 4-10 that are giving me problems. HTML Code: <html> <head> <title>Final Emailer</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <!-- ImageReady Slices (Final Emailer.psd) --> <table id="Table_01" width="600" height="801" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="5"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_01.png"></td> </tr> <tr> <td colspan="5"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_02.png"></td> </tr> <tr> <td rowspan="4"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_03.png"></td> <td colspan="2"> <a href="mailto:info@shorehomeguide.com"><img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_04.png" border="0"></a></td> <td colspan="2" rowspan="2"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_05.png"></td> </tr> <tr> <td colspan="2"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_06.png"></td> </tr> <tr> <td rowspan="2"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_07.png"></td> <td colspan="2"> <a href="http://lynchprintingllc.wordpress.com/publications/home-improvement-guide/" target="blank"><img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_08.png" border="0"></a></td> <td rowspan="2"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_09.png"></td> </tr> <tr> <td colspan="2"> <img src="http://i1190.photobucket.com/albums/z451/LynchPrinting1/hig%20final%20sliced%20222/Final-Emailer_10.png"></td> </tr> <tr> </table> <!-- End ImageReady Slices --> </body> Hello, I've been working on a very simple website for a friend, and run into an issue with text alignment when I print from IE (works fine in Firefox). The problem can be seen he While being displayed correctly on the screen, a big gap appears between the image an the body text during printing. As I am not even nearly an expert, I cannot figure out what causes the problem. Any help would be appreciated! Thank you! Below is my simple table from a more complex table. The issue I am having is the first <td></td> is variable height. In my second <td></td>, "abc" should be at the top in that <td> and "def" should be at the bottom in that <td>, leaving some <void> space in the middle which will shrink or grow based on the first <td> height. Any tag(s) can be used inside is the second <td></td> Any suggestions? Thanks Code: <table> <tr> <td><br><br><br><br><br><br><br><br></td> </tr> <tr> <td> abc def </td> </tr> </table> Is it possible to a background as a layer(that is the background is a centered layer no matter how big a monitor's screen is)? A simple javascript won't be bad, i'm still a html beginner, i've done the first part of a university course on html but i'm designing a website that may need some features more advanced than i've gotten in the course. Also, can someone explain to me how forums work or how they are written in html. I don't understand how to make a forum that can accept posts immediately (kinda like this one). Is a javascript necessary for forums? Thanks a lot ____________ conservatories Fruit Machines Hi All, Here is a small html file I have written. This is not formatting correctly in browser. Width is not recognised by browser. Thanks in advance for your help. Regards, Pratap Tripathy ---------------------------------- <html> <head> <TITLE>Analytical Method Report</TITLE> </head> <body> <center><p><b><u>Analytical Method Report</u></b></p></center> <table border=1 width="700px"> <tr> <td width="10px"> </td> <td width="80px">Method</td> <td width="10px">:</td> <td width="500px">11111111111111111111111111111111111111111111111111111111111111111111111111111111111111 1111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222 2222222222222222222222222222222222222222222222222222223333333333333333333333333333333333333333333333 3333333333334444444444444444444444444444444444444444444444444444444455555555555555555555555555555555 55555555555555<</td> </tr> </table> </html> ---------------------------------- OK this is by no means a major problem. It's more of an annoyance. On my login script I have a basic form for logging in. Fire fox and IE will keep my login information for me when I get to the login page. The issue is that when the page loads my user name field will be blank however my email and password fields will have my info in it. On any other site I use, I would get the user name and email fields with my info and the password field blank. That's the way it should be. Below you will find a snipit of the code, There has to be something I'm missing. Thanks for your help! Code: <form action="index.php" method="post" name="user_login"> <tr> <td class="formNames" align="right" valign="middle" width="50%"> User Name: </td> <td align="left" valign="middle" width="50%"> <input class="formText" name="user_name" type="text" size="20" maxlength="35" value="<?php echo $user_name; ?>" /> </td> </tr> <tr> <td class="formNames" align="right" valign="middle"> Email Address: </td> <td align="left" valign="middle"> <input class="formText" name="email" type="text" size="20" maxlength="35" value="<?php echo $email; ?>" /> </td> </tr> <tr> <td class="formNames" align="right" valign="middle"> Password: </td> <td align="left" valign="middle"> <input class="formText" name="password" type="password" size="20" maxlength="25" /> </td> </tr> <tr> <td colspan="2" align="center"> <input class="submitButton" type="submit" value="Submit" name="enter" /> </form> </td> </tr> Thanks again!! Regards Guyzer Hello HTMLforums.com community! I am doing some minor web design for an NPO (non-profit organization) in my community. There are some pages that exhibit this strange spacing between the headers and body as you will see on the following pages: http://www.gadshillcenter.org/progra...grams_main.php http://www.gadshillcenter.org/progra...enservices.php http://www.gadshillcenter.org/progra...connection.php This same thing happens with all other program_??.php pages. However, it does not happen on the following, seemingly identical templates: http://gadshillcenter.org/report/report_main.php http://gadshillcenter.org/newsevents...herreading.php http://gadshillcenter.org/newsevents...blications.php There doesn't seem to be borders on any of the pictures, so I see no reason for the indent that pushed the picture and top-left edge down one row. I use Microsoft Office Sharepoint Designer 2007. If you would like to view the code for any pages, just ask! Any ideas why? I could ENTIRELY reformat the pages, put them into tables and what-not, but that would take a while. Is there any way around this? Thank you all! Sincerely, Andrew I just finished writting an HTML email. All looked fine when it was in the browser then I tested it in my email client and all the layout is wrong. my </BR> dont seem to have any affect also im not sure why only some of the   are being shown and not displayed as spaces (??) Heres the code : Code: Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit MIME-Version: 1.0 <html> <style type="text/css"> body { font-family:verdana; font-size:90%; line-height:160%; } table.mainsection { background-color:#838B8B; width:50%; color:white; text-align:left; font-size:99%; padding:1px; margin-top:5px; } table.subsection { background-color:#B7C3D0; color:white; width:49%; color:white; text-align:left; font-size:88%; margin-left:14px; margin-top:5px; padding:1px; } </style> <body> <img src="http://graphics.adaptec.com/us/templates/head_logo.gif" /> <p> <table class=mainsection > </tr> <th>Logical device information</th> <tr> </table> Logical device number 0</br>    Logical device name : RAID1Mirror</br>    RAID level : 1</br>    Status of logical device : Optimal</br>    Size : 476150 MB</br>    Read-cache mode : Enabled</br>    Write-cache mode : Enabled (write-back)</br>    Write-cache setting : Enabled (write-back)</br>    Partitioned : No</br>    Protected by Hot-Spare : No</br>    Bootable : Yes</br>    Failed stripes : No</br> <table class=subsection > </tr> <th>Logical device segment information</th> <tr> </table>    Segment 0 : Present (0,0) </br>    Segment 1 : Present (0,1) </br> <table class=mainsection > </tr> <th>Physical Device information</th> <tr> </table>    Channel #0:</br>       Transfer Speed : SATA 3.0 Gb/s</br>       Device #0</br>          Device is a Hard drive</br>          State : Online</br>          Supported : Yes</br>          Transfer Speed : SATA 3.0 Gb/s</br>          Reported Channel,Device : 0,0</br>          Vendor : ST350032</br>          Model : 0A</br>          Firmware : SD15</br>          Size : 476940 MB</br>          Write Cache : Enabled (write-back)</br>          FRU : None</br>          S.M.A.R.T. : No</br>       Device #1</br>          Device is a Hard drive</br>          State : Online</br>          Supported : Yes</br>          Transfer Speed : SATA 3.0 Gb/s</br>          Reported Channel,Device : 0,1</br>          Vendor : ST350032</br>          Model : 0A</br>          Firmware : SD15</br>          Size : 476940 MB</br>          Write Cache : Enabled (write-back)</br>          FRU : None</br>          S.M.A.R.T. : No</br> <table class=mainsection > </tr> <th>Controller information</th> <tr> </table>    Controller Status : Optimal</br>    Channel description : SATA</br>    Controller Model : Adaptec 2420SA</br>    Controller Serial Number : CCEE20</br>    Physical Slot : 2</br>    Installed memory : 128 MB</br>    Copyback : Disabled</br>    Background consistency check : Disabled</br>    Automatic Failover : Enabled</br>    Defunct disk drive count : 0</br>    Logical devices/Failed/Degraded : 1/0/0</br> <table class=subsection > </tr> <th>Controller Version Information</th> <tr> </table>    BIOS : 5.2-0 (15611)</br>    Firmware : 5.2-0 (15611)</br>    Driver : 1.1-5 (2459)</br>    Boot Flash : 5.2-0 (15611)</br> <table class=subsection > </tr> <th>Controller Battery Information</th> <tr> </table>    Status : Not Installed</br> </p> </html> Thanks, |