dazza7
02-19-2008, 01:07 PM
Hi,
Having problems with the below script, I need to get the productDescription which matches the entry (orderProductArray) after it it is entered.
The Enter Item quantity prompt has the have the item description that matches the item that was previous entered.
I then need to output the item no entered, quantity and the matching product description.
The results of my script give an Undefined message.
Help appreciated.
var productCodes = ['a-23-009', 'k-246-07', 'd-555-01', 'n-87-012', 'u-521-08', 't-99-002'];
var productDescriptions = ['Superslurry electric blender', 'Apple - iPod (second-hand)', 'CoziNap nylon duvet tog 2', 'Headbanger mini hi-fi 20W', 'MagiBoot shoe cleaning kit', 'The PushmiPulu lawnmower'];
var orderProductArray = new Array();
var orderQuantityArray = new Array();
// indentify number of items
itemstobeOrdered = parseFloat(window.prompt('Enter the number of different items to be purchased',''));
// for loop to allow entry of items and quantities
for (var count = 0; count < itemstobeOrdered ; count = count + 1)
{
orderProductArray[count] = window.prompt('Enter Item No', '')
// Quantity Prompt
orderQuantityArray[count] = window.prompt('Enter Item quantity ' + productDescriptions[orderQuantityArray], '')
};
for (var count = 0; count < itemstobeOrdered; count = count + 1)
{
document.write('Item no: ' + orderProductArray[count] + 'Item Desc: ' + productDescriptions[orderQuantityArray] +
'Quantity: ' + orderQuantityArray[count] + '<BR>')
}
Having problems with the below script, I need to get the productDescription which matches the entry (orderProductArray) after it it is entered.
The Enter Item quantity prompt has the have the item description that matches the item that was previous entered.
I then need to output the item no entered, quantity and the matching product description.
The results of my script give an Undefined message.
Help appreciated.
var productCodes = ['a-23-009', 'k-246-07', 'd-555-01', 'n-87-012', 'u-521-08', 't-99-002'];
var productDescriptions = ['Superslurry electric blender', 'Apple - iPod (second-hand)', 'CoziNap nylon duvet tog 2', 'Headbanger mini hi-fi 20W', 'MagiBoot shoe cleaning kit', 'The PushmiPulu lawnmower'];
var orderProductArray = new Array();
var orderQuantityArray = new Array();
// indentify number of items
itemstobeOrdered = parseFloat(window.prompt('Enter the number of different items to be purchased',''));
// for loop to allow entry of items and quantities
for (var count = 0; count < itemstobeOrdered ; count = count + 1)
{
orderProductArray[count] = window.prompt('Enter Item No', '')
// Quantity Prompt
orderQuantityArray[count] = window.prompt('Enter Item quantity ' + productDescriptions[orderQuantityArray], '')
};
for (var count = 0; count < itemstobeOrdered; count = count + 1)
{
document.write('Item no: ' + orderProductArray[count] + 'Item Desc: ' + productDescriptions[orderQuantityArray] +
'Quantity: ' + orderQuantityArray[count] + '<BR>')
}