In: Computer Science
Exercise 12.4: Use a browser's developer tools to view the DOM
tree of the document in Fig. 12.4. Look at the document tree of
your favorite website. Explore the information these tools give you
in the right panel(s) about an element when you click it.
Please use the Chrome browser:
Write a paragraph or two about what you learned about using the Chrome developer tools.
<!DOCTYPE html>
<html>
<head>
<title>DOM</title>
</head>
<body>
<p>Enter num1: <input type="number" id="num1"
/></p>
<p>Enter num2: <input type="number" id="num2"
/></p>
<p><input id="cal" type="submit" value="Calculate"
/></p>
<h2 id="op"></h2>
<script type="text/javascript">
var number1 = document.getElementById('num1');
var number2 = document.getElementById('num2');
var buton = document.getElementById('cal');
var output = document.getElementById('op');
btn.addEventListener('click',function() {
var ot=
parseInt(num1.value)+parseInt(num2.value);
console.log(ot);
out.innerHTML = 'TIP is:
'+ot;
});
</script>