Website Construction Summary (Cont.)

  1. Adding a Navigation Menu Using JavaScript
  2. Two tools are used in the JavaScript script Script.js below:

    JavaScript
    JavaScript is commonly used to create interactive effects within web browsers, whose implementations allow client-side JavaScript scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.

    DOM (Document Object Model)
    The HTML DOM is the standard for accessing HTML elements.
    The W3C DOM is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document.
    Using the DOM, JavaScript can change and manipulate HTML. One of many methods in the DOM is document.getElementById. The following example “finds” the element with id="foot01" and id="nav01" in the HTML files, and changes its content (innerHTML):

    ~/public_html/demo/AJAX/Script.js
     document.getElementById("foot01").innerHTML =
      "<p>©  " + new Date( ).getFullYear( ) +
      " Wen-Chen Hu. All rights reserved.</p>";
    
     document.getElementById("nav01").innerHTML =
      "<ul id='menu'>" +
       "<li><a href='index.html'>Home</a></li>" +
       "<li><a href='Student.html'>Data</a></li>" +
       "<li><a href='About.html'>About</a></li>" +
      "</ul>";




      Q: Why can’t a bike stand by itself?    
      A: Because it is two tired.