|
|
Killersites.com Forum » List all forums » » Forum: HTML and JavaScript. » » » Thread: Javascript and Functions » » » » Post: Javascript and Functions |
Print at May 25, 2013 11:35:47 AM |
| Posted by terivo at Apr 30, 2006 2:09:38 PM |
|
Javascript and Functions Sorry for the VERY beginning code but I am having trouble tyring to get these functions to work. Could someone please help and see where I am going wrong? This is just the program, all tags are there just not listed here. function START() { var name var sales var total var total_com var sales = new Array(3) var com Print_Header() Initialize() name = prompt("Enter salesperson's name or Quit to end") while(name != Quit) { Data_Inputs(sales) Calculations(com,total_com,sales) Print_Detail(name,com) name = prompt("Enter salesperson's name or Quit to end") } Print_com(total_com) } function Print_Header() { document.write("********************<br>") document.write("******Project 6******<br>") document.write("********************<br>") } function Initialize(total_com) { total_com = 0 return total_com } function Data_Inputs(sales) { sales[0] = eval(prompt("Enter sales amount #1","")) sales[1] = eval(prompt("Enter sales amount #2","")) sales[2] = eval(prompt("Enter sales amount #3","")) return sales } function Calculations(com, total_com, sales) { var sum sum = sales[0] + sales[1] + sales[2] com = sum * .20 total_com = total_com + com return com, total_com, sales } function Print_Detail(name,com) { document.write("Salesperson, " + name + " made $" + com + " on all total sales"+"<br>")) } function Print_com(total_com) { document.write("The total commission amount made is $" + total_com+"<br>") } Thanks in advance to anyone who can help. |
|
|
Current timezone is GMT May 25, 2013 11:35:47 AM |