Your problem is:
thirdnum==parseInt(number3); is a comparison, not an assignment, so thirdnum will always be 0.
Since you are multiplying by thirdnum, and anything ×ばつ 0 is 0, you will always get 0 as the output.
Change == to =.
This would have been picked up if you had QAed your code with JS Hint .
Your bad practises which you should fix are:
num1.valueassumes global JS variables will be created for every element with an id. Don't assume that, usedocument.getElementByIdparseInt(number1)doesn't have a radix. Always specify the number system you are using (normally base 10) so it isn't inferred from the data for unexpected results:parseInt(number1, 10);<form name="Example1">, the name attribute on forms is a legacy from before theidattribute had come around properly. Useidto identify elements for client side code.onclickattributes do a poor job of separating concerns. UseaddEventListener(or a library such as YUI or jQuery if you need to support old versions of IE).
Your problem is:
thirdnum==parseInt(number3); is a comparison, not an assignment, so thirdnum will always be 0.
Your bad practises which you should fix are:
num1.valueassumes global JS variables will be created for every element with an id. Don't assume that, usedocument.getElementByIdparseInt(number1)doesn't have a radix. Always specify the number system you are using (normally base 10) so it isn't inferred from the data for unexpected results:parseInt(number1, 10);<form name="Example1">, the name attribute on forms is a legacy from before theidattribute had come around properly. Useidto identify elements for client side code.onclickattributes do a poor job of separating concerns. UseaddEventListener(or a library such as YUI or jQuery if you need to support old versions of IE).
Your problem is:
thirdnum==parseInt(number3); is a comparison, not an assignment, so thirdnum will always be 0.
Since you are multiplying by thirdnum, and anything ×ばつ 0 is 0, you will always get 0 as the output.
Change == to =.
This would have been picked up if you had QAed your code with JS Hint .
Your bad practises which you should fix are:
num1.valueassumes global JS variables will be created for every element with an id. Don't assume that, usedocument.getElementByIdparseInt(number1)doesn't have a radix. Always specify the number system you are using (normally base 10) so it isn't inferred from the data for unexpected results:parseInt(number1, 10);<form name="Example1">, the name attribute on forms is a legacy from before theidattribute had come around properly. Useidto identify elements for client side code.onclickattributes do a poor job of separating concerns. UseaddEventListener(or a library such as YUI or jQuery if you need to support old versions of IE).
Your problem is:
thirdnum==parseInt(number3); is a comparison, not an assignment, so thirdnum will always be 0.
Your bad practises which you should fix are:
num1.valueassumes global JS variables will be created for every element with an id. Don't assume that, usedocument.getElementByIdparseInt(number1)doesn't have a radix. Always specify the number system you are using (normally base 10) so it isn't inferred from the data for unexpected results:parseInt(number1, 10);<form name="Example1">, the name attribute on forms is a legacy from before theidattribute had come around properly. Useidto identify elements for client side code.onclickattributes do a poor job of separating concerns. UseaddEventListener(or a library such as YUI or jQuery if you need to support old versions of IE).