The code is relatively long, so I will give it to you in module-like forms with the explanation. There is only one HTML page here, which is the master page. The skeleton of the master page is as follows:
//Minimum code used by all pages is here.
<!—The HTML elements are here -- >
You also have the BODY element with its start and end tag. There are two principal elements in the BODY element. You have the DIV element and the SCRIPT element. The Script element is in the DIV element. All the HTML elements for the master page are in this DIV element.
At the bottom, you have the SCRIPT element. In general, this SCRIPT element has statements that download text (pages) in advance using Ajax. In this simple example only the second page will be downloaded.
The Head Script
Here, I talk about the script in the HEAD element of the master page. This is the script:
var theArray = new Array()
document.getElementById('theDIV').innerHTML = theArray;
The First Page
The DIV element has the content of the page and the script. Remember that for the first page, all of these are with the master page at the server. This is what our simple example has (the script is not shown):
This is the first page.<br />
<button type="button" onclick="showSecondPage()">Next Page</button>
You have the string, “This is the first page,” followed by the “<br />” element, followed by the button. When this button is clicked, the “showSecondPage()” function is called. This function produces the next page.
blog comments powered by Disqus