473,698 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help with simple price x quantity calculation

8 New Member
I have a very simple price times quantity calculation.

The input is STWCORQuant:

Expand|Select|Wrap|Line Numbers
  1. <input name="STWCORQuant" class="contactitalicbold" id="STWCORQuant" onChange="javascript:STWCORPrice();" value="0" size="8" style="text-align: right; font-family: ver">
And the fucntion is STWCORPrice():

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript" type="text/javascript">
  2.  
  3. function STWCORPrice() {
  4.         var price = 0;
  5.         var shipping = 0;
  6.         var total=0;
  7.         var qnty=document.all.STWCORQuant.value;
  8.  
  9.         if (qnty > 49 && qnty < 75){
  10.                     price = 23;
  11.                     shipping = 6.25;
  12.                     }
  13.  
  14.                 else if (qnty > 74 && qnty < 100){
  15.                     price = 17;
  16.                     shipping = 6.25;
  17.                         }
  18.  
  19.                 else if (qnty > 99 && qnty < 200){
  20.                     price = 14;
  21.                     shipping = 6.25;
  22.                         }
  23.  
  24.                 else if (qnty > 199 && qnty < 250){
  25.                     price = 13.75;
  26.                     shipping = 7.75;
  27.                         }
  28.  
  29.         total = (price * qnty)+shipping;        
  30.         document.all.STWCORIssueCost.value= '$ '+ total.toFixed(2);
  31.     }
  32.  
  33. </script>
  34.  
The output is this:

Expand|Select|Wrap|Line Numbers
  1. <td width="15%" id="STWCORIssueCost" Font Class="sidemenutextgrn" align="right">$0</Font></td>
It doesn't work, but looks like it should. When a quantity is input and the box is tabbed out of, nothing happens. I can't tell what is wrong....need help!

Thanks
Nov 19 '08
12 2551
Dormilich
8,658 Recognized Expert Moderator Expert
@acoder
I think, node.nodeValue should work also.

regards
Nov 21 '08 #11
acoder
16,027 Recognized Expert Moderator MVP
Actually, it wouldn't. You'd need to use firstChild.node Value in place of innerHTML.
Nov 21 '08 #12
Dormilich
8,658 Recognized Expert Moderator Expert
you're right, I forgot the child status of the text node.....

Dormi
(doing currently too much PHP)
Nov 21 '08 #13

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

Similar topics

1
6086
by: bin_P19 P | last post by:
the code i have got is as follows and now im stuck <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Shopping Cart</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="StyleSheet" href="css/style.css" type="text/css">
3
3167
by: ChadDiesel | last post by:
Hello everyone. I need some advice on table structure for a new project I've been given. One of our customers sends us an Excel spreadsheet each week containing their order. Currently, someone formats the spreadsheet, prints it out, and manually picks out the products we need to ship. I want to import this into an Access table. Basically, the sheet with some data examples looks something like this: ...
2
1708
by: Shannan Casteel via AccessMonster.com | last post by:
I have a subform for listing parts. It has fields including: ClaimID, ITEM, NET PRICE, LIST PRICE, Quantity, Supplier, and a calculated field called Part Total. The subform is based on a query. The Part Total field is calculated as (=.*.). Then there is a hidden text box on my subform that calculates the sum of all the Part Totals for each claim. There is another field on my main form set equal to this field on the subform. My...
35
2301
by: eyoung | last post by:
I call a function that takes the unit price and quantity ordered to create an amount...it looks something like this. function calculateCost() { quantity=document.RFO.quantity.value; unitPrice=document.RFO.unitPrice.value; total=0; if(isPositiveInteger(quantity)) {
2
1313
by: Srikanth | last post by:
Hi, My requirement is to have the datagrid perform the work of an order entry system. The specifications are something like this. I have got a table in MS-Access, named master_software, whose fields are: soft_name, edition, manufacturer, price. My data grid would contain the following columns: Software Name,
1
1097
by: lucky29105 | last post by:
Hello- I cant seem to figure out why I am getting the following error: cannot find symbol : class CD location: class Inventory5 CD cd = (CD)supplies; ^ I'm getting this on several lines, and something tells me it is a silly error, but I can't find it. Here is the part of the code where I get the errors: CD cd = (CD)supplies;
1
1665
by: wynn | last post by:
I had created a shopping cart website using visual studio 2005 web developer I got this error when i doing update the shopping cart, can anyone please help me solve this problem thanks very much Dim cn As New SqlClient.SqlConnection() cn.ConnectionString = ConfigurationManager.ConnectionStrings("ASPNETDBConnectionString1").ConnectionString Dim ProductId As String ProductId = Session("PI") ...
13
2077
by: jcato77 | last post by:
I am having trouble figuring out my code and was hoping someone could point me in the right direction. Below is my code what I need to due is create a method to add and display the value of the entire inventory. I have what I think is the correct code but it's not working. Help is greatly appreciated class Inventory3 { public static final int MAXIMUM_ITEMS = 4; private static Product product = new Product; public static void...
1
2006
by: Luron31 | last post by:
Hello everyone, im doing a project and im really stuck on it... i dont want answers. i have a very guilty conscience. i just need some hints as to what im doing wrong or what i could do right... "A VendingMachine object represents a vending machine that sells products like candy or soda. It has a fixed number of slots, each of which can hold one kind of product for sale. For example, a machine might have 10 Snickers bars in slot 0 and...
0
8678
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2333
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.