|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 3
|
|
| Author |
|
|
Stranger Joined: Apr 30, 2006 Post Count: 1 Status: Offline |
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. |
||
|
|
Advanced Member USA Joined: Nov 27, 2003 Post Count: 6285 Status: Offline |
What will happen when a use agent is used with no JavaScript support or a user chooses to or is forced to have JavaScript turned off? I do not use JavaScript, it is to dangerouse and keeps to many people from using my sites, so i cannt help you. However it would seem that this is a important part of your site, so you must have it available for those who have JS turned off for what ever reason or use non-JS compatible user agaents like internet compatible game pads, game consoles, TV, cell phones, PDAs and text browsers and text browser based screen readers. The majority of all these do not support JS at all. What you are trying to do is likely doable using othe rlanguages like PHP or Perl. Be very carefull if you keep using JavaScript and be sure to use DOM based script so that there is a chance that it will still be useable. I would suggest though that you use PHP instead. |
||
|
|
Advanced Member UK Joined: Dec 29, 2004 Post Count: 1662 Status: Offline |
Don't forget to place a ";" at the end of each statement. Tim ---------------------------------------- Pavonis Mons | Listen of the week: "Residue of Desire" by Acumen |
||
|
|
|
|
|
Current timezone is GMT May 20, 2013 1:51:16 PM |