Lab 19

During lab 19 which was very similar to lab 18 we had to create another calculator but it already had the first initial number value saved. The point of lab 19 was to give the initial value why the user added in the second value. In the site there was similar arithmetic buttons from lab 18 that allowed the user to interact with the initial value and add their own value to do some simple math. I first copied the first few codes from lab 18 because they both were very similar but in lab 18 the user would have to give two values not one and in lab 19 there was already an initial number. The initial number I kept was the number 5. So then I deleted the values for the first number and the input box and just left my initial number. Then usign the same form code for the second value;<form> <br> <label>Second Number:</label> <input type="text" id="secondNumber"> </form>.  Then after this i proceeded to code the rest of the javascript so that the initial number would interact with the user value.  Doing this i first changed the variable value 1 to var Value 1 = 5 to indicate the initial number then for the second number i created a .document. varValue2=document.getElementById("secondNumber").value;. This then allowed me to store the second value. Following this i then coded the function for adding as shown below:
function Adding(){
var Value1= 5; var Value2= document.getElementById("secondNumber").value; document.getElementById("answer").innerHTML = (Number(Value1) + Number(Value2)); This took both x and y values and added them to create an answer. Continued this for all arithmetic functions. These skills are very important to a web designer because it allows the website to become more interactive with the user and can be used for many just operations. This helps us retrieve certain information from the user which is good for an online store or something. Also helps us give an information and see how the user interacts with it.

Comments

Popular posts from this blog

Lab 7

Lab 8 Reflection

Current Events 2