It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Newb Having trouble with script

Newb Having trouble with script

Postby bluefoxaj on Mon Feb 04, 2008 2:38 am

I am having a heck of a time trying to figure out why my function is not showing a display when I run my .js everything else works but the function area. Below is a copy of my code

var amount_per_hour = parseFloat(prompt("Enter amount of money per hour?", "Enter Amount Per Hour Here"));
var hours_worked = parseFloat(prompt("How many hours for one week?", "Enter Hours Here"));
var hours = 40.0;
var over_time_hours = (hours_worked - hours)
var time_and_half = 1.5;
if (hours_worked > hours) {
total_gross = (amount_per_hour * over_time_hours * time_and_half) + (amount_per_hour * hours);
total_gross = total_gross.toFixed(2);
}
else {
total_gross = (hours_worked * amount_per_hour).toFixed(2);
}
document.writeln("The total gross salary for the week is $" + total_gross +"<p>");
function calculations(grosspay){
var fed_tax = 0.31;
var fed_tax_total = (total_gross * fed_tax);
fed_tax_total = fed_tax_total.toFixed(2);
document.writeln("Federal Taxes = $" + fed_tax_total + "<br>");
var state_tax = 0.08;
var state_tax_total = (total_gross * state_tax);
state_tax_total = state_tax_total.toFixed(2);
document.writeln("State Taxes = $" + state_tax_total + "<br>");
var local_tax = 0.02;
var local_tax_total = (total_gross * local_tax);
document.writeln("Local Taxes = $" + local_tax_total + "<br>");
}

Any help would be appreciated because I'm completely lost at this point.

Thanks
AJ
bluefoxaj
 
Posts: 0
Joined: Sun Feb 03, 2008 11:26 pm

Postby DDragon on Wed Feb 20, 2008 5:12 am

document.writeln <--- im not sure that is the right code for that there... but i might be wrong.

DD
DDragon
50+ Club
 
Posts: 93
Joined: Wed Jun 20, 2007 12:51 am
Location: Australia


Who is online

Users browsing this forum: No registered users and 6 guests