I have been playing with two options but just dont seem to get the coding right. Can someone please assist. Using ie9 but same problem with all browsers. Gives Nan.

first snippets.
HTML:

Code:
<!-- Row 3, Col 3 purchase boxes -->
<td colspan="1" height="120" align="left">
<input style="margin-left: 60px" type="text" name="bed_359" size="3" maxlength="3" onchange="calculateValue(this.form)" /> R359</td></tr>
 
<!-- Row 10, Col 2 Order Value Box-->
<td colspan="1" align="left"><input style="margin-left: 60px" type="text" name="total" size="10" 
onfocus="this.form.elements[0].focus()" />
</td></tr>
javaScript:

Code:
// Function to calculate order value 
function calculateValue(orders) {
var orderValue = 0;
var value = 0;
var itemPrice = 0;
var itemQuantity = 0;
 
// Run through all the product fields
for(var i = 0; i < orders.elements.length; ++i) {
 
// Get the current field
formField = orders.elements[i];
 
// Get the fields name
formName = formField.name;
 
// Items price extracted from name
itemPrice = parseFloat(formName.substring(formName.lastIndexOf("_") + 1));
 
// Get the Quantity
itemQuantity = parseInt(formField.value);
 
// Update the OrderValue
if(itemQuantity >= 0) {
value = itemQuantity * itemPrice;
orderValue += value;
}
}
 
// Display the total
orders.total.value = orderValue;
}
Second code:

Code:
<!-- Row 9, Col 3 purchase boxes -->
<td colspan="1" height="120" align="left"> 
<select style="margin-left: 60px" name="shirt" value="215" onchange="calculateValue(this.form)" />
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option></select> R215</td></tr>
Java

Code:
// Function to calculate order value    
function calculateValue(orders) {
    var orderValue = 0;
    var value = 0;
    var itemPrice = 0;
    var itemQuantity = 0;
 
    // Run through all the product fields
    for(var i = 0; i < orders.elements.length; ++i) {
 
    // Get the current field
    formField = orders.elements[i];
 
    // Get the fields name
    formValue = formField;
 
    // Items price extracted from name
    itemPrice = formField;
 
    // Get the Quantity
    itemQuantity = formField.selectedIndex;
 
    // Update the OrderValue
    if(itemQuantity > 0) {
    orderValue += itemQuantity * itemPrice
    }
    }
 
    // Display the total
    orders.total.value = orderValue.toLocaleString();
}
Please help its probably something simple.