Code:
<script> function muloperator() { var val1 = parseInt(document.getElementById("txt1").value); var val2 = parseInt(document.getElementById("txt2").value); var ans=document.getElementById("demo") } sum() { ans.value = val1+ val2; } minus() { ans.value = val1 - val2; } mul() { ans.value = val1+ val2; } div() { ans.value = val1+ val2; } </script> <body> <fieldset> <form> <input type="text" id="txt1" name="text1"> <input type="text" id="txt2" name="text2"> <input type="button" value="+" name="submit"><input type="button" value="-" name="submit"> <input type="button" value="*" name="submit"> <input type="button" value="/" name="submit"> <input type="text" id="demo" name="demo" onclick="muloperator()"/>
Comment