Break it down:
document.form1.cboProcessor refers to a <select>.
It refers to the *entire* <select> object, with all its properties.
document.form1.cboProcessor.selectedIndex is just ONE property of that <select>.
Specifically, it is the index number (0 to n) of the <option> currently chosen by the user.
document.form1.cboProcessor[ ] refers to the collections of <option>s for that <select>.
It's a synonym for
document.form1.cboProcessor.options[ ]
So, finally,
document.form1.cboProcessor[document.form1.cboProcessor.selectedIndex] refers to *ONE* <option> of that <select>.
Specifically, it refers to the one <option> currently chosen by the user.
So in this case, the variable
formElement is now a reference to a single <option>.
And then
formElement.value is whatever the value property of that option (e.g., <option value="7.35">) is.
Finally,
formElement.text is the text that appears between the <option> and </option> tags for that particular <option>.
NOTE: You *could* get the value of the selected <option> by simply coding
document.form1.cboProcessor.value
But that wouldn't help you get the .text of that same <option> and so would be no great help in this particular code.
***************
Personally, I'd rewrite that code, to make it more obvious what is happening.
Thus:
Code:
function updateOrderDetails()
{
var sel = document.form1.cboProcessor;
var opt = sel[sel.selectedIndex];
var val = parseFloat(opt.value);
var txt = opt.text;
orderDetails = "Processor : " + txt + " $" + val.toFixed(2) + "\n";
...
I don't see total being used for anything there, so I omitted it.