I am trying to show my output inside the third box but it shows the output in a separate page. How to solve that.
function mul(){
var a=parseInt(document.getElementById("f_num").value);
var b=parseInt(document.getElementById("s_num").value);
var res= a*b;
document.write(res);
}
function div(){
var a=parseInt(document.getElementById("f_num").value);
var b=parseInt(document.getElementById("s_num").value);
var res= a/b;
document.write();
}
<form>
<input type="text" id="f_num" placeholder="Enter your first number"><br><br>
<input type="text" id="s_num" placeholder="Enter your second number"><br><br>
<input type="submit" value="Multiply" onclick="mul()">
<input type="submit" value="Divide" onclick="div()"><br><br>
<input type="text">
</form>