HTML and CSS Reference
In-Depth Information
from earlier and rename it ajax , and then edit index.html to look like the following
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>HTML5 Apprentice</title>
<link rel="stylesheet" type="text/css"
href="css/styles.css" />
<script type="text/javascript" src="js/
script.js"></script>
</head>
<body>
<button
id="prevButton">Previous</button>
<p id="message"></p>
<button id="nextButton">Next</button>
</body>
</html>
This page contains two buttons and an empty paragraph between the two that we'll
fill with content using Ajax. Open script.js from the ajax/js directory. Add the
following script:
// create global variables
var xmlhttp;
var prevbutton;
var nextbutton;
var message;
var messageID = 1;
// initialize variables and add event listening functions
function init() {
prevbutton
=
docu-
ment.getElementById("prevButton");
nextbutton
=
docu-
ment.getElementById("nextButton");
message = document.getElementById("message");
Search WWH ::




Custom Search