Commit 8b748561 authored by O'Reilly Media, Inc's avatar O'Reilly Media, Inc
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+18 −0
Changes for Appendix B/JavaScriptEvents.html: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>JavaScript Events</title>
<script>
function showMessage() {
  alert("We interrupt this web page with a special JavaScript announcement.");
}
</script>
</head>

<body>
  <p>Move the mouse pointer over this picture to see a secret message.</p>

  <img src="sunny.jpg" alt="A sunny day" onmouseover="showMessage()">
</body>
</html>
+34 −0
Changes for Appendix B/ManipulateAnElement.html: 34 added lines, 0 removed lines.
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Manipulate An Element</title>
<script>
window.onload = function() {
  var imgObject = document.getElementById("dayImage");
  imgObject.onclick = swapImage;
};

var dayTime = true;

function swapImage() {
  // This function runs when the onClick event happens.
  var imgObject = document.getElementById("dayImage");
  if (dayTime == true) {
    dayTime = false;
    imgObject.src = "cloudy.jpg";
  }
  else {
    dayTime = true;
    imgObject.src = "sunny.jpg";
  }
}
</script>
</head>

<body>
  <p>Click this picture to change sun to cloud (and back).</p>

  <img id="dayImage" src="sunny.jpg" alt="The weather">
</body>
</html>
+18 −0
Changes for Appendix B/SimpleJavaScript.html: 18 added lines, 0 removed lines.
Original line number Diff line number Diff line
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>A Simple JavaScript Example</title>
</head>

<body>
  <p>At some point in the processing of this page, a script block
will run and show a message box.</p>

  <script>
alert("We interrupt this web page with a special JavaScript announcement.");
  </script>

  <p>If you get here, you've already seen it.</p>
</body>
</html>

Appendix B/cloudy.jpg

0 → 100755
+8.54 KiB
Loading image diff...

Appendix B/sunny.jpg

0 → 100755
+21.2 KiB
Loading image diff...
Loading