M
Mark Scott
Hi
I am trrying to write an application which allows you to select a car from
an array. I have the following code:
var carMake = ['Ford', 'Vauxhall', 'Renault', 'VolksWagen'];
var carModel = ['Focus', 'Astra', 'Laguna', 'Golf'];
var carIndex, input
input = window.prompt("Please Enter a car Make")
for (carIndex = 0; carIndex < carMake.length; carIndex = carIndex + 1)
{
if (input == carMake[carIndex])
{
document.write("You have chosen the "+carMake[carIndex]+" "+
carModel[carIndex])
}
}
If I enter a car make which is not in the array (ie BMW) how do I get the
program to continue prompting until I enter a legal make?
I am trrying to write an application which allows you to select a car from
an array. I have the following code:
var carMake = ['Ford', 'Vauxhall', 'Renault', 'VolksWagen'];
var carModel = ['Focus', 'Astra', 'Laguna', 'Golf'];
var carIndex, input
input = window.prompt("Please Enter a car Make")
for (carIndex = 0; carIndex < carMake.length; carIndex = carIndex + 1)
{
if (input == carMake[carIndex])
{
document.write("You have chosen the "+carMake[carIndex]+" "+
carModel[carIndex])
}
}
If I enter a car make which is not in the array (ie BMW) how do I get the
program to continue prompting until I enter a legal make?