4.2. Meet the DOM (again)Although you may not have realized it, you've been using the DOM since way back in Chapter 1. Remember this code from Katie's Boards 'R' Us report? function updatePage() { var newTotal = request.responseText ; var boardsSoldEl = document.getElementById("boards-sold"); var cashEl = documentThe document object gives JavaScript access to the DOM tree that the web browser creates..getElementById("cash"); ...We've left out the rest of the code from this function. } And here's some similar code from the Break Neck pizza app: function getCustomerInfo() { var phone = Here's that document object again.document.getElementById("phone").value; var url = "lookupCustomer.php?phone=" + escape(phone); request.open("GET", url, true); request.onreadystatechange = updatePage; request.send(null); } The "document" object gives your JavaScript access to the web browser's DOM tree. Don't miss this... it's probably the most important thing in the whole chapter! |