View Single Post
Old 11-18-2012, 04:40 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,452
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
1. Don't use prompt() as it is intended for debugging only - use a form in your web page instead to collect the values.

2. Don't use document.write - that went out of use when Netscape 4 died as subsequent browsers support the far more powerful innerHTML call instead.

If someone is actually teaching either of those then they need to take a beginners JavaScript class to learn how to write JavaScript for 21st century web browsers.

To be able to advise how to set up a for loop to process the five input fields we will first need to see how you have defined the form. You can convert strings to numbers using either Number(str) or (+str)

You can use Math.max() and Math.min() to get the maximum and minimum values.
__________________
Stephen
Learn Modern JavaScript - http://javascriptexample.net/
Helping others to solve their computer problem at http://www.felgall.com/
felgall is offline