473,473 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to auto calculate?

2 New Member
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
2 4646
gits
5,390 Recognized Expert Moderator Expert
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
arteopilar
2 New Member
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: 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
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,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.