View Single Post
Old 10-11-2012, 07:18 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
If you click a submit button, the associated form will be submitted. This is the default behaviour of the click event. The same applies to onsubmit for the form itself.

To prevent the default behaviour you will have to take measures like "return false" from the event handler.
Code:
<input type="submit" value="submit" name="submit" id="submit" onclick="calculator(); return false;" />
On top of this you should not return a value from the calculator function. So just remove the "return" from document.write in the last statement
devnull69 is offline   Reply With Quote