Killersites.com Homepage Welcome Guest   |   Register  |  Login
Login Name Password
  Search  
  Index  | Recent Threads  | Unanswered Threads  | Who's Online  | User List  | Help


Quick Go »

No member browsing this thread
Thread Status: Active
Total posts in this thread: 3
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 3168 times and has 2 replies Next Thread
Female terivo
Stranger




Joined: Apr 30, 2006
Post Count: 1
Status: Offline
Reply to this Post  Reply with Quote 
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.

[Apr 30, 2006 2:09:38 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest [Link] Report threatening or abusive post: please login first  Go to top 
Male LSW
Advanced Member
Member's Avatar

USA
Joined: Nov 27, 2003
Post Count: 6285
Status: Offline
Reply to this Post  Reply with Quote 
Re: Javascript and Functions

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.
[Apr 30, 2006 4:27:14 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male tpattison
Advanced Member
Member's Avatar

UK
Joined: Dec 29, 2004
Post Count: 1662
Status: Offline
Reply to this Post  Reply with Quote 
Re: Javascript and Functions

Don't forget to place a ";" at the end of each statement.


Tim
----------------------------------------
Pavonis Mons | Listen of the week: "Residue of Desire" by Acumen
[May 1, 2006 2:02:25 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread