This is just an exercise I’m trying to complete. I was thinking in terms of creating an order form in the most basic way. I have a basic array with a list of guitars. I would have a user put a number in the first field and that number would reference an index in a array to put the array element in another text box. This is what I have at this point-
var gbrand = ('Jackson', 'BC Rich', 'Gibson', 'Fender', 'Dean', 'ESP', 'Fernandez');
function ordernum(gbrand)
{
var order = document.order.perchnumb.value
if ( order != '' )
{
order = gbrand[index];
document.order.instrum.value = order;
}
}
Using your code, I would say this should do the trick:
If you leave your code like that,
var gbrandwill live in the global namespace, making it available to the functionordernumwithout actually passing it to the function as an argument.