Friday, June 9, 2017

lab 17 reflection

In lab 17 what i did is make pop when adding two number and it will ask you if you want to replace the value of the first number if they say okay then the number change if they say no the number of the first value dose not change. I did this making a adding function and a replacement function.

function addReplace() {
var y = document.getElementById("txt1").value;
var z = document.getElementById("txt2").value;
document.getElementById("txt1").value = +y + +z;
document.getElementById("demo").innerHTML = document.getElementById("txt1").value;
}

function add() {
var y = document.getElementById("txt1").value;
var z = document.getElementById("txt2").value;
var x = +y + +z;
document.getElementById("demo").innerHTML = x;
}
the hardest hart was making it replace the value but i solve this help from my peers. I will not will being using this in the future because it work.

No comments:

Post a Comment