I have a select box whose onChange attribute executes the functions given as:
<select id="shipping_method" name="shipping_method" onChange="javascript:quantity(), price(), Shipping();" style="width: 209px;">
<option value="">Select Shipping</option>
<option value="standard">Standard (7 - 12 days from proof)</option>
<option value="expedited">Expedited (5 work days from Proof)</option>
</select>
In JavaScript, a comma separates a sequence of expressions. The expressions are evaluated in turn from left to right. This is often used when declaring variables:
And omitting braces from if statements:
But they can generally be used to separate any expression, providing the expressions that are being seperated don’t contain language construct statements like
return,if,break, etc.In the example you supplied, it’s more or less the same as
(note the
javascript:label is not required in event handlers and it doesn’t do what you probably think it does. Also, to avoid confusion when working with DOM events, try and stick to lowercase event names instead of camelCase.