Adding Up, Calculating Value?

Mar 1, 2010

i have a table, with 2 numeric values at the minute, if the checkbox is selected I want the total price to be shown? this is the form I have with the numeric values

<form id="calculation" action="#" method="post">
100 <input type="checkbox" name="check1" value="100" onClick='total_cost()'/>
120 <input type="checkbox" name="check2" value="200" onClick='total_cost()'/>[code].....

View 5 Replies


ADVERTISEMENT

Calculating A Person's Age?

Dec 1, 2010

I am trying to write a script that will take a date of birth and another date and, if the person was over 75 years old on the createdDate, return "true" (otherwise return "false").

Unfortunately my code doesn't seem to return either 'true' or 'false'!

The code is:

var dateofBirth="30/10/1982";
var createdDate="01/12/2010";
var sd = dateofBirth.split('/');
var dob = new Date(sd[2],sd[1],sd[0]);

[Code]....

View 2 Replies View Related

Calculating Client IP Address

Jul 23, 2005

I want to create a link that a user can click which will create a popup
telling the user their ip address. I have:

var ip = new java.net.InetAddress.getLocalHost().toString();
alert("Your IP address is: " + ip.substring(ip.indexOf("/")+1))

but this does not seem to work. It says the ip is 127.0.0.1. Strangely,
this piece of code used to work but all of a sudden it doesn't for some
unknown reason. Can anyone tell me what's wrong with the above code?

View 3 Replies View Related

Calculating Difference Between Two Dates Using JS

Nov 10, 2006

I have two date fields (check in, check out) and "number of days"
field.

I want the script to calculate automatically the difference.
For example: I have defaults dates, and I want the script to put the
difference in "number of days" field. And if the user will change the
date, the number of days will change automatically.

View 1 Replies View Related

Calculating Age From Date Of Birth?

Jul 11, 2009

I am using date of birth field in my application and i m taking date of birth in yyyy-mm-dd format.

I need to calculate age by using this date of birth and should show alert if age is less than 5 years.

View 2 Replies View Related

Calculating Shipping With If/else And Function?

Sep 21, 2009

I am having difficulty getting the following assignment to run properly:Many companies charge a shipping and handling charge for purchases. Create a Web page that allows a user to enter a purchase price into a text box and includes a JavaScript function that calculates shipping and handling. Add functionality to the script that adds a minimum shipping and handling charge of $1.50 for any purchase that is less than or equal to $25.00.For any orders over $25.00, add 10% to the total purchase price for shipping and handling,but do not include the $1.50 minmum shipping and handling charge. The formula for calculating a percentage is price * percent / 100. For example, the formula for calculating 10% of a $50.00 purchase price is 50 * 10 / 100, which results in a shipping and handling charge of $5.00. After you determine the total cost of the order (purchase plus shipping and handling), display it in an alert dialog box. Save the document as CalcShipping.html.This is what I have after working on it round and round for 4 hours yesterday:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">[code].....

View 5 Replies View Related

Auto Calculating Form

Mar 22, 2007

I've been googleing for a auto calculating form and found nothing, I just want something .. some form, that can add values from different fields ... and make a sum .. in real time ... meaning that ... if I put X value in field #1 and Y value in field #2, at the bottom or somewhere I should have the X+Y value :P..

View 4 Replies View Related

Calculating Textbox Value For Html?

Mar 6, 2010

calculating textbox value from java script for html

Example: (textbox1value X textbox2value) + (textbox3value + textbox4value)= result

where result value should display in textbox5

View 1 Replies View Related

Calculating Difference Between The Two Numbers?

Jul 2, 2009

the following javascript is not calculating the difference between the two numbers.cant understand y

<script language="JavaScript" type="text/javascript">
function showAmt(){
total = document.total.value;[cod

View 2 Replies View Related

Calculating The Average/mean In An Array ?

Mar 30, 2011

Im trying to calculate the mean/average of numbers in an array.how can i get the length of an array to perform in a simple / maths problem whilst being flexiable to the length of the array?

function sum()
{
var i=0 [code].....

View 2 Replies View Related

Calculating Percentage In A Form?

Mar 23, 2010

I am writing a form and doing a bunch of calculations one of which is a percentage based on the value selected. I am returning a correct result for two of the values but for the other two I am not.The 'discount' value is what I am looking for. It should return as 0 for values of 1 but it is doing the math as though it is multiplying by 1. And again for the value of 6 it should be 10% but is taking the value as 4.6 or something.Code is below I've included all of it (sorry) for better ease of understanding the math that is happening:

HTML Code:

<form id="form1" action="" method="get">
<fieldset>
<p>[code]......

View 3 Replies View Related

Calculating Possible Routes Between Two Points

Oct 18, 2011

I am not a developer so not so familiar with javascript. Suppose I have a map with ten junctions and based on that map. I need to calculate all the possible routes between one junction to another. How do I represent the map in javascript and how do I code the function to calculate all the possible routes?

View 1 Replies View Related

Calculating Amount Of Time?

Nov 15, 2011

I was wondering if it is possible to figure out the amount of time passed from a specific time in history till the present? If so how? I have tried so many different things and I am not getting the right returns.

View 3 Replies View Related

Calculating The Scroll Area?

Jun 19, 2009

I am writing a DHTML application which uses AJAX to show dialogue windows etc.. (all the bells and whistles).When I display a DHTML dialogue in the foreground, I use JS to create a div which is a "layer" in between the foreground and the background which essentially "darkens" the background and disables all background functionality. Forcing the user to take action in the dialogue.How do I get the total scrollable area of the page so I know how big to make the "dark" div?I have tried all of these:

document.body.scrollWidth
document.body.scrollHeight
document.body.offsetWidth

[code]...

They all work in one browser or another, (I am testing in IE, FF and Opera) but none of them give me the correct values for the exact scrollable area of the page.

View 3 Replies View Related

Calculating A Score From A Row Of Drop-down Values

Aug 11, 2006

I need help in calculating a score from a row of drop-down values.
I need to use the onChange to tally the score as the user moves across
9 categories (with drop-down selection of 1-9 or N/A) multiplied by a
weighted score. The final column for each employee would be the
calculated score. I know how to accomplish this with vbscript but I
need it to process on the screen so the user can see the calculated
score as they make selections. Also the code needs to execute as many
times as there are employee rows.(loop) I don't know how to do this
with Javascript

Here's the VBscript with the variables involved
Var S1 = Category 1 Weighted score
Var S2 = Category 2 Weighted score
Var S3 = Category 3 Weighted score
Var S4 = Category 4 Weighted score
Var S5 = Category 5 Weighted score
Var S6 = Category 6 Weighted score
Var S7 = Category 7 Weighted score
Var S8 = Category 8 Weighted score
Var S9 = Category 9 Weighted score
D5 = 0.92
Var Q11 = Category 1 drop-down Value(1-9) * S1
Var Q22 = Category 2 drop-down Value(1-9) * S2
Var Q33 = Category 3 drop-down Value(1-9) * S3
Var Q44 = Category 4 drop-down Value(1-9) * S4

If (Category 5 Value = "N/A") THEN
Q55 = ' '
Else
Var Q55 = Category 5 drop-down Value(1-9 or N/A) * S5
End If

Var Q66 = Category 6 drop-down Value(1-9) * S6
Var Q77 = Category 7 drop-down Value(1-9) * S7
Var Q88 = Category 8 drop-down Value(1-9) * S8
Var Q99 = Category 9 drop-down Value(1-9) * S9

If (Category 5 = "N/A") THEN
Var FinalScore = round(((Q11 + Q22 + Q33 + Q44 + Q66 + Q77 + Q88 + Q99)
/ D5),2)
else
Var FinalScore = round((Q11 + Q22 + Q33 + Q44 + Q55 + Q66 + Q77 + Q88 +
Q99),2)
end if

Can anyone help me converting this to javascript?

View 1 Replies View Related

JQuery :: Calculating Value Based On Two Sliders?

Oct 14, 2009

I am trying to calculate a value based on two sliders.

This is the code that I am using:

var value1;
var value2;
$(function() {

[Code]....

View 2 Replies View Related

JQuery :: Calculating Height Of DIV Elements

Feb 7, 2011

I have a div that is absolutely positioned and stretch on all sides using top:
10px; left: 10px; bottom: 10px; right: 10px;
When I try to get the height of the div, using $('#id').height(); I get 0 (zero). Is there a problem calculating the height of elements like this one, or am I missing something?

View 5 Replies View Related

Calculating Values From Radio Buttons?

Mar 15, 2009

I have an assignment in which the person has to choose their department and their hourly wage is given for each department. In the text box they must put their hours worked for the week, which I can't seem to get to work this is what I have:

<form id="employeeGroup">
<table width="398" border="0" align="center" cellpadding="10">
<tr>[code]............

View 4 Replies View Related

Calculating Sum And Average Of Integers And Display Value

May 25, 2009

I'm a newbie to javascript and I made this script
<script>
var num = parseInt(prompt("Enter the number of integers to follow"));
var sum = 0;
for (i = 0; i < num; i++){
sum += parseInt(prompt("Enter a number"));
}

if (isNaN(num)) {
alert("Invalid");
} else {
if (sum < 0) {
document.writeln("The sum is 0 and the average is 0");
} else {
document.writeln("The sum is " + sum + " and the average is " + sum/num);
}
}
</script>

The scenario : Create in javascript that will read a series of integers at the terminal. The first integer is special, as it indicates how many more integers will follow. Your javascript is to calculate the sum and average of the integers, excluding the first integer, and display these values to the screen. If the total is not greater than 0 then display "The sum is 0 and the average is 0". Did I write the script correctly? am I missing anything that a dumb person might do? for example the person might type in letters instead of numbers.

View 3 Replies View Related

Calculating Fees In Percentage In A Form?

Apr 4, 2011

I'm stuck on how to calculate the payment fee of 1.61% on top of the membership price. Also, how do I round the figures to 2 decimal places?Here's the Javascript so far:

<script type="text/javascript">
var member_prices = new Array();
member_prices["no"]=235.00;[code].....

View 10 Replies View Related

External Calculating Wrong Form?

May 10, 2011

I am using the same java script to help add shipping costs for paypal in my html.I have worked very long and hard to get to this point.I have saved and named each java script for it's form.However, when there are more then one on the html page it always calculates the last form giving me the wrong price per quantity on the first.I have not found a way to differentiate or id and separate.

<script src="nineEnvelope.js" type="text/javascript">
</script>
<form target="paypal" style="position:absolute; left:500px;top:200px; width:400px; [code].....

View 5 Replies View Related

Calculating Dynamic Field Names

Jun 20, 2005

I have several fields being updated for a parking structure... The client inputs the number of cars and can immediately see the percentage before updating the database....

The field names always change so I need the JavaScript to be able to pick up the unique field names calculate and place into the total field box...

I found this code online, but I need to do this dynamically for hundreds of lots...

So basically I have a field name and an ID number identifying the 3 related fields...

Here's an example that works for one lot:

<HEAD>
<script type="text/javascript">
<!-- Begin
function startCalc(){
interval = setInterval("calc()",1);

[Code]....

View 2 Replies View Related

Auto Calculating Dynamic Feilds

Mar 1, 2011

This is some of the code I am using to add dynamic rows when user clicks the Add Row button.

View 5 Replies View Related

Calculating And Displaying Vote Total For?

May 12, 2011

I'm creating a website where users won't need to register but can vote for one thing once per day. What I'm having trouble with however is how to go about calculating each vote, and displaying the total votes next to each item. Every a time user votes, I want the total to be updated and shown in the red areas next to the choices that can be voted for.

[Code]...

View 1 Replies View Related

Implementing Array And Then Calculating The Average?

Sep 16, 2011

She's wanting an array that will store points awarded and then calculate the average. It will also then show the distribution of the allocated grades (that I'm not having trouble with - just pulling the averages from the array data).

This is my code so far:

<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http:www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http:www.w3.org/1999/xhtml">
<head>

[Code]....

I've tried different ways, most ending in the 'average' variable being undefined or when the button is pressed and the function 'ReturnAverage' called it doesn't do anything. I'm using Eclipse as my IDE to work on this and check syntax.

View 2 Replies View Related

Code Required For Calculating Height?

Jul 5, 2009

I am working on outlet pages of an online store.There are 4 products displayed on each row.On that store, products are displayed with images,product name, model no., price and buttons.For some products, the name is longer, for some price is longer.I am using <td> for displaying each information.The problem is - the height of the name's <td> and price's <td> are different for different products.I want a JS code which can detect the biggest height (for each row separately) from both the above td's separately and assign the maximum height to the corresponding 3 td's of that row.This should be done for each row separately.note : I an right now using this code - But it takes the height of both td's for 1st product only and assign it to all the products.

<script type="text/javascript" language="javascript">
var ht1 = document.getElementById("name_td1").offsetHeight;
document.getElementById("name_td1").style.height = ht1;

[code].....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved