473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to auto calculate?

Hello, I am really with coding. But am in need of hints and answers with my project. I need to learn how the javascript will auto compute the total cost if

total cost =delivery modes price multiply by the number of pages.
delivery modes has an equivalent price per mode

Hope someone can help with this...


Here is the html code

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4. <title>total amount</title>
  5. </head>
  6.  
  7. <body>
  8. <table  id="AutoNumber5">
  9.   <tr>
  10.     <td>
  11.     Delivery Modes:</td>
  12.     <td>
  13.     <select class="input-text" name="modes" id="modes">
  14.     <option value ="1" selected="">7 days</option>
  15.     <option value ="2">5 days</option>
  16.     <option value ="3">3 days</option>
  17.     <option value ="4">2 days</option>
  18.     <option value ="5">24 hrs</option>
  19.     <option value ="6">12 hrs</option>
  20.     <option value ="7">8 hrs</option>
  21.     <option value ="8">30-day dissertation</option>
  22. </select></td>
  23.   </tr>
  24.   <tr>
  25.     <td>
  26.     Number of Pages:</td>
  27.     <td>
  28.     <select id='pages' name="pages" class="input-text"  onChange="new_Price();" >
  29.     <option selected>2</option>
  30.     <option value="3">3</option>
  31.     <option value="4">4</option>
  32.     <option value="5">5</option>
  33.     <option value="6">6</option>
  34.     <option value="7">7</option>
  35.     <option value="8">8</option>
  36.     <option value="9">9</option>
  37.     <option value="10">10</option>
  38.  
  39.   </select></td>
  40.   </tr>
  41.   <tr>
  42.     <td>
  43.    Cost Per Page (USD):</td>
  44.     <td>
  45.     <input class="input-text" size="5" name="costperpage" readonly="readonly"/></span></td>
  46.   </tr>
  47.   <tr>
  48.     <td>
  49.     Total Amount (USD):</td>
  50.     <td>
  51.    <input class="input-text" id='totalamount' size="20" name="totalamount" readonly="readonly" /></span></td>
  52.   </tr>
  53. </table>
  54.  
  55. </body>
  56.  
  57. </html>
May 15 '10 #1

✓ answered by gits

you would need to call a function that would retrieve the values from the the document's nodes and does the calculation.

to retrieve a value you might use:

Expand|Select|Wrap|Line Numbers
  1. var val = document.getElementById('anId').value;
since you want to calculate with the values you should be aware that the retrieved values are always of type string so you might parse them as numbers when you need that with parseInt() or parseFloat() for example ...

try to make a start and post back when you have further problems with it.

kind regards

2 4642
gits
5,390 Expert Mod 4TB
you would need to call a function that would retrieve the values from the the document's nodes and does the calculation.

to retrieve a value you might use:

Expand|Select|Wrap|Line Numbers
  1. var val = document.getElementById('anId').value;
since you want to calculate with the values you should be aware that the retrieved values are always of type string so you might parse them as numbers when you need that with parseInt() or parseFloat() for example ...

try to make a start and post back when you have further problems with it.

kind regards
May 15 '10 #2
tanx for your help....
Jun 10 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Theodore A. Jencks | last post by:
Hi all, I posted a question about a side navigation bar earlier where I was encountering this problem. I thought I'd repost the question in a more general format because I'm not sure people...
3
by: carla | last post by:
I am using Access 2000 and have a table, tblCurrent. That table contains several fields - three of those fields are , and . What I want to accomplish in my data entry form, is first entering the...
49
by: Thom Little | last post by:
I developed a C# application and a windows installer application that properly installs the C# application on a new machine. After the C# application is installed I would like to automatically...
2
by: john | last post by:
Is it true that if I split my access database in backend and frontend and I implement custom auto increment for the ID fields, that my database is ready to be used in a multi-user environment? I...
1
by: kunal0101 | last post by:
Hi, I am a new user to access and am building a database to capture the rotation dates for employees. There is a table called "Rotation schedule" which contains "name", "Duration (in weeks) and...
3
by: nimda via AccessMonster.com | last post by:
hii..i'm new here and dummies in access..i create one form that count total salary.i have 3 field.let say a,b and c.c is auto calculate and will show the total of a and b.my problem is when i look...
3
by: Chesne | last post by:
Can anyone point me in the right direction please I have a table with the following fields , Enddate], in dollars) and in an Accommodation db. I would like to get a total for each month,...
2
by: viporyo | last post by:
I'm creating an Access Database 2003 for our Human Resource Dept. In the form, I will be adding a calendar wherein there will be date of hire, start date, etc. I need to be able to view the...
7
by: mell | last post by:
I am the new programmer. I have encounter with the problem to calculate the date auto beacuse I has been assign to develop library system for my final project...How I can automatik calculte the date...
6
by: awojciehowski | last post by:
I am working with a database now and need some guidance. I am attempting to input an auto calculation. I have the ability to enter a date in a text box on a form. I want to be able to have...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.