CS311-3-FALL19-Solution-File
-
Re: CS311 Assignment 3 Solution and Discussion
CS311-3-Solution
bc0000000_CS311_S3.html<!DOCTYPE html> <html> <body> <h1>My Books Collection:</h1> <button type="button" style="font-size:14px; " onclick="if (!window.__cfRLUnblockHandlers) return false; loadXMLDoc()" data-cf-modified-18337bf230a59fc34ce33f82-=""> Display My Books </button> <br> <table id="demo"></table> <script type="18337bf230a59fc34ce33f82-text/javascript"> function loadXMLDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == 200) { myFunction(xhttp); } }; xhttp.open("GET", "books_data.xml", true); xhttp.send(); } function myFunction(xml) { var i; var xmlDoc = xml.responseXML; var table="<br> "; var a = xmlDoc.getElementsByTagName("book"); for (i = 0; i <a.length; i++) { <!--getElementsByTagName method and childNodes property--> table +="<tr><td>"+a[i].getElementsByTagName("name")[0].childNodes[0].nodeValue+"</td></tr>"; } document.getElementById("demo").innerHTML = table; } </script> <script src="https://ajax.cloudflare.com/cdn-cgi/scripts/7089c43e/cloudflare-static/rocket-loader.min.js" data-cf-settings="18337bf230a59fc34ce33f82-|49" defer=""></script></body> </html>
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
