Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I pasted my work so far that works. <html> <head> <script> function doAdd() { va

ID: 3938351 • Letter: I

Question

I pasted my work so far that works.

<html>
<head>
<script>
function doAdd() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var c = a + b;
document.getElementById('box3').value = c;
}
function doSub() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var d = a - b;
document.getElementById('box3').value = d;
}
function doMultiply() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var e = (a*b);
document.getElementById('box3').value = e;
}
function doDiv() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var f = (a/b);
document.getElementById('box3').value = f; }
  

</script>
</head>
<body>
<input type = "text" id = 'box1'>
<br>
<input type = "text" id = 'box2'>
<button>+</button>
<button>-</button>
<button>*</button>
<button>/</button>
<button>Clear</button>

<br>
<input type = "text" id = 'box3'>
</body>

</html>

Clear

Explanation / Answer

<html>
<head>
<script>
function doAdd() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var c = a + b;
document.getElementById('box3').value = c;
}
function doSub() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var d = a - b;
document.getElementById('box3').value = d;
}
function doMultiply() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var e = (a*b);
document.getElementById('box3').value = e;
}
function doDiv() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var f = (a/b);
document.getElementById('box3').value = f;

}
function doPow() {
var a = parseInt(document.getElementById('box1').value);
var b = parseInt(document.getElementById('box2').value);
var f = 1;

for(i=0;i<b;i++)

{

f=f*a;

}
document.getElementById('box3').value = f;

}

function doClear() {
document.getElementById('box1').value=" ";
document.getElementById('box2').value=" ";
  
document.getElementById('box3').value = " ";

}

</script>
</head>
<body>
<input type = "text" id = 'box1'>
<br>
<input type = "text" id = 'box2'>
<button>+</button>
<button>-</button>
<button>*</button>
<button>/</button>

<button>^</button>
<button>Clear</button>

<br>
<input type = "text" id = 'box3'>
</body>

</html>