Bear Bibeault wrote:Your function expects two parameters yet you call it with none.
Bear Bibeault wrote:No. Your function is defined as:
which expects two arguments which it will multiply. If you pass nothing, it will multiply undefined by undefined and the result is clearly not a number (expressed as NaN).
Bear Bibeault wrote:In the following code, where do you pass two numbers?
You pass nothing.
What is it you want to be multiplying together? Those values need to be passed to the function.
Bear Bibeault wrote:No, those variables are undefined in the onchange handler.
It seems you are just guessing at this point; you need to ask yourself what values you want to actually pass into the function. When onchange triggers, what is it you actually want to have happen?
Bear Bibeault wrote:No, those variables are undefined in the onchange handler.
It seems you are just guessing at this point; you need to ask yourself what values you want to actually pass into the function. When onchange triggers, what is it you actually want to have happen?
Bear Bibeault wrote:In order to use getElementById, the element must have an id. The name is not the same as an id. (name is only used for form submission, so you don't really even need one here.)
There is also getElementsByName if you want to continue to use names.