I'm adding the ability for the user to input his own values into 6 input fields, some or all of which may be left blank. I have already an array populated (thanks to Paul Wilkins) with default values. How do I get the user's values into that array so the calculations will be performed on it?

I got this far, but was unable to understand the problems brought up by JSHint.com.

Now that you have this set up in php, make the html section. This will work because php renders/compiles before the page is loaded, so the javascript just sees the variables as straight up text or strings, and acts like you just typed them directly in there.

<html><head><script type="text/javascript">

var spur = new Array();spur[0] = <?php echo $spur1; ?>;spur[1] = <?php echo $spur2; ?>;etc...//After all this, you now have an array to use in javascript as you please.

</script></head><body></body></html>

This may be too much in a different direction than you wanted, or you may not even have php running on the server you're using, so don't assume this is the only way to do this. This is just the way I would suggest you go, if you have php of course.

StevenHu
—
2011-06-13T14:29:07Z —
#3

Thanks for the help, but I can't use PHP for this application. I don't see how to get the values of the array from within a Switch context so it fits in with the rest of the Switch statement.