Total members 10262 | Gratitudes |It is currently Thu May 24, 2012 9:57 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Question
 Question subject: Need help with JavaScript function calculate the total pric!
PostPosted: Thu Jun 04, 2009 9:23 pm 
Offline
Newbie
User avatar

Joined: Thu Jun 04, 2009 8:59 pm
Posts: 1
Has thanked: 0 time
Have thanks: 0 time

Hi, I have this exercise to do, and it's almost finished but I am stuck on the calculation. I need to calculate the total price. Not sure what I need to do to make the totalprice function work.
This is just a learning material. It only works in IE, and it's not a problem.
I can email the code to someone if needed.

This is the function that should calculate within a form but it doesn't.

function calculate(value)
{
var totalprice = value;
var notickets = value;
var ticketprice = value;
var add = 10

if(notickets < 4)
{
totalprice = (ticketprice * (notickets))

}

else if(notickets >= 4)
{
totalprice = (ticketprice * (notickets)) + add

}

else
{
alert("Before you can calculate your total price you have to make your selection.")
return false
}
}


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  

 Similar topics
 total ocurrence of substring in sting
 JavaScript fade out problem
 calculate speed of a car in javaCV
 javascript read file
 getting gst, pst total to diplay in my javascript form
 need help with javascript
 total
 Javascript select menu validation issue
 validate age entered as selection box in javascript
 Trim string in JavaScript

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team