Browse files

Add source files

  • Loading branch information...
1 parent ce1fd82 commit af579e9e3098356a21b4683fdf5c0e243cdb52e5 @taggon committed Mar 16, 2012
Showing with 11,229 additions and 0 deletions.
  1. +23 −0 chapter01/1.1.html
  2. +25 −0 chapter01/1.2.html
  3. +132 −0 chapter01/1.3.html
  4. +24 −0 chapter01/complete_1.1.html
  5. +25 −0 chapter01/complete_1.2.html
  6. +137 −0 chapter01/complete_1.3.html
  7. BIN chapter01/images/even_td_bg.png
  8. BIN chapter01/images/th_bg.png
  9. +27 −0 chapter02/2.1.html
  10. +31 −0 chapter02/2.2.html
  11. +31 −0 chapter02/2.3.html
  12. +105 −0 chapter02/array_methods.html
  13. +34 −0 chapter02/complete_2.1.html
  14. +28 −0 chapter02/complete_2.2.html
  15. +42 −0 chapter02/complete_2.3.html
  16. +31 −0 chapter03/3.1.html
  17. +30 −0 chapter03/3.2.html
  18. +34 −0 chapter03/3.3.html
  19. +42 −0 chapter03/complete_3.1.html
  20. +33 −0 chapter03/complete_3.2.html
  21. +61 −0 chapter03/complete_3.3.html
  22. +41 −0 chapter03/complete_do_while.html
  23. +34 −0 chapter04/4.1.html
  24. +88 −0 chapter04/complete_4.1.html
  25. +32 −0 chapter04/dateString.html
  26. +52 −0 chapter04/dateString.js
  27. +24 −0 chapter04/example_regex.txt
  28. +29 −0 chapter04/printTime.js
  29. +3 −0 chapter04/random.js
  30. +196 −0 chapter04/regex_tester.html
  31. +30 −0 chapter04/time.html
  32. +62 −0 chapter05/5.1.html
  33. +59 −0 chapter05/5.2.html
  34. +55 −0 chapter05/5.3.html
  35. +45 −0 chapter05/bibliography.html
  36. +64 −0 chapter05/complete_5.1.html
  37. +66 −0 chapter05/complete_5.2.html
  38. +70 −0 chapter05/complete_5.3.html
  39. +136 −0 chapter05/content_functions.html
  40. BIN chapter05/gradient.png
  41. +209 −0 chapter05/selectors.html
  42. +142 −0 chapter06/6.1.html
  43. +53 −0 chapter06/6.2.html
  44. +147 −0 chapter06/complete_6.1.html
  45. +63 −0 chapter06/complete_6.2.html
  46. +43 −0 chapter06/coordinates.html
  47. +373 −0 chapter06/events.html
  48. BIN chapter06/images/close.png
  49. BIN chapter06/images/open.png
  50. +36 −0 chapter07/7.1.html
  51. +52 −0 chapter07/7.2.html
  52. +56 −0 chapter07/7.3.html
  53. +48 −0 chapter07/7.4.html
  54. +52 −0 chapter07/complete_7.1.html
  55. +77 −0 chapter07/complete_7.2.html
  56. +83 −0 chapter07/complete_7.2_advanced.html
  57. +64 −0 chapter07/complete_7.3.html
  58. +72 −0 chapter07/complete_7.4.html
  59. BIN chapter07/css/.DS_Store
  60. +1 −0 chapter07/css/_notes/dwsync.xml
  61. +72 −0 chapter07/css/gallery.css
  62. +101 −0 chapter07/css/lightbox.css
  63. +45 −0 chapter07/css/slideshow.css
  64. +207 −0 chapter07/effects.html
  65. BIN chapter07/images/large/blue.jpg
  66. BIN chapter07/images/large/fan.jpg
  67. BIN chapter07/images/large/green.jpg
  68. BIN chapter07/images/large/milk.jpg
  69. BIN chapter07/images/large/orange.jpg
  70. BIN chapter07/images/large/purple.jpg
  71. BIN chapter07/images/large/red.jpg
  72. BIN chapter07/images/large/weight.jpg
  73. BIN chapter07/images/large/yellow.jpg
  74. BIN chapter07/images/lightbox-btn-close.gif
  75. BIN chapter07/images/lightbox-btn-next.gif
  76. BIN chapter07/images/lightbox-btn-prev.gif
  77. BIN chapter07/images/lightbox-ico-loading.gif
  78. BIN chapter07/images/small/blue.jpg
  79. BIN chapter07/images/small/blue_h.jpg
  80. BIN chapter07/images/small/green.jpg
  81. BIN chapter07/images/small/green_h.jpg
  82. BIN chapter07/images/small/orange.jpg
  83. BIN chapter07/images/small/orange_h.jpg
  84. BIN chapter07/images/small/purple.jpg
  85. BIN chapter07/images/small/purple_h.jpg
  86. BIN chapter07/images/small/red.jpg
  87. BIN chapter07/images/small/red_h.jpg
  88. BIN chapter07/images/small/yellow.jpg
  89. BIN chapter07/images/small/yellow_h.jpg
  90. +40 −0 chapter08/8.1.html
  91. +49 −0 chapter08/8.2.html
  92. +57 −0 chapter08/8.3.html
  93. +44 −0 chapter08/complete_8.1.html
  94. +77 −0 chapter08/complete_8.2.html
  95. +52 −0 chapter08/complete_8.3.html
  96. +24 −0 chapter08/css/bigLink.css
  97. +17 −0 chapter08/css/clickable.css
  98. BIN chapter08/greybox/close.gif
  99. BIN chapter08/greybox/close2.gif
  100. +91 −0 chapter08/greybox/complete_greybox2.css
  101. +91 −0 chapter08/greybox/greybox2.css
  102. +73 −0 chapter08/greybox/horz_menu.css
  103. +99 −0 chapter08/greybox/jquery.greybox2.js
  104. BIN chapter08/greybox/loading.gif
  105. BIN chapter08/greybox/macFFBgHack.png
  106. BIN chapter08/images/flames.png
  107. +41 −0 chapter08/open_external_links.html
  108. +1 −0 chapter08/pages/_notes/dwsync.xml
  109. +33 −0 chapter08/pages/a_page.html
  110. +34 −0 chapter08/pages/about.html
  111. +33 −0 chapter08/pages/another_page.html
  112. +34 −0 chapter08/pages/books.html
  113. +34 −0 chapter08/pages/cds.html
  114. +34 −0 chapter08/pages/contact.html
  115. +34 −0 chapter08/pages/driving.html
  116. +34 −0 chapter08/pages/dvds.html
  117. +34 −0 chapter08/pages/new.html
  118. +34 −0 chapter08/pages/products.html
  119. +34 −0 chapter08/pages/used.html
  120. BIN chapter08/superfish/.DS_Store
  121. +1 −0 chapter08/superfish/_notes/dwsync.xml
  122. +7 −0 chapter08/superfish/complete_siteJS.js
  123. +92 −0 chapter08/superfish/horz_menu.css
  124. +3 −0 chapter08/superfish/horz_menu_ie.css
  125. +1 −0 chapter08/superfish/images/_notes/dwsync.xml
  126. BIN chapter08/superfish/images/arrow_down.png
  127. BIN chapter08/superfish/images/arrow_left.png
  128. BIN chapter08/superfish/images/arrow_left_over.png
  129. BIN chapter08/superfish/images/button_bg.png
  130. BIN chapter08/superfish/images/button_bg_over.png
  131. +100 −0 chapter08/superfish/superfish.js
  132. +557 −0 chapter09/9.1.html
  133. +90 −0 chapter09/9.2.html
  134. +582 −0 chapter09/complete_9.1.html
  135. +125 −0 chapter09/complete_9.2.html
  136. +97 −0 chapter09/css/complete_form.css
  137. +83 −0 chapter09/css/form.css
  138. +35 −0 chapter09/process.html
  139. +165 −0 chapter09/validation/additional-methods.js
  140. +16 −0 chapter09/validation/jquery.validate.js
  141. +37 −0 chapter10/10.1.html
  142. +33 −0 chapter10/10.2.html
  143. +41 −0 chapter10/10.3.html
  144. +108 −0 chapter10/10.4.html
  145. +39 −0 chapter10/accordion.css
  146. +12 −0 chapter10/chia.html
  147. +49 −0 chapter10/complete_10.1.html
  148. +40 −0 chapter10/complete_10.2.html
  149. +60 −0 chapter10/complete_10.3.html
  150. +116 −0 chapter10/complete_10.4.html
  151. +34 −0 chapter10/complete_tables.css
  152. +72 −0 chapter10/complete_tabs.css
  153. BIN chapter10/images/arrowdown.gif
  154. BIN chapter10/images/arrowleft.gif
  155. BIN chapter10/images/arrowright.gif
  156. BIN chapter10/images/arrowup.gif
  157. BIN chapter10/images/darrowdown.gif
  158. BIN chapter10/images/darrowleft.gif
  159. BIN chapter10/images/darrowright.gif
  160. BIN chapter10/images/darrowup.gif
  161. BIN chapter10/images/down_arrow.png
  162. BIN chapter10/images/ramchia.jpg
  163. BIN chapter10/images/up_arrow.png
  164. BIN chapter10/images/wait.gif
  165. +154 −0 chapter10/jquery.cluetip.css
  166. +20 −0 chapter10/tables.css
  167. +11 −0 chapter10/tabs.css
  168. +43 −0 chapter11/11.1.html
  169. +47 −0 chapter11/11.2.html
  170. +49 −0 chapter11/complete_11.1.html
  171. +60 −0 chapter11/complete_11.2.html
  172. +34 −0 chapter11/lastweek.html
  173. +17 −0 chapter11/login.php
  174. +33 −0 chapter11/today.html
  175. +34 −0 chapter11/yesterday.html
  176. +28 −0 chapter12/12.1.html
  177. +41 −0 chapter12/12.2.html
  178. +37 −0 chapter12/complete_12.1.html
  179. +71 −0 chapter12/complete_12.2.html
  180. +20 −0 chapter12/complete_map.css
  181. +6 −0 chapter12/complete_myTabs.js
  182. +86 −0 chapter12/complete_tabs.css
  183. BIN chapter12/images/.DS_Store
  184. +1 −0 chapter12/images/_notes/dwsync.xml
  185. BIN chapter12/images/loading.gif
  186. BIN chapter12/images/rush.jpg
  187. BIN chapter12/images/tabs1.png
  188. BIN chapter12/images/tabs2.png
  189. BIN chapter12/images/tabs3.png
  190. +16 −0 chapter12/map.css
  191. +16 −0 chapter12/photos.html
  192. +16 −0 chapter12/reviews.html
  193. +19 −0 chapter12/specs.html
  194. +83 −0 chapter12/tabs.css
  195. +37 −0 chapter13/13.1.html
  196. +104 −0 chapter13/13.2.html
  197. +47 −0 chapter13/complete_13.1.html
  198. +102 −0 chapter13/completed_13.2.html
  199. +1 −0 chapter13/css/13.css
  200. +99 −0 chapter14/jquery.greybox2.js
  201. BIN chapter14/yuicompressor-2.3.5.jar
  202. +464 −0 css/global.css
  203. +91 −0 css/greybox2.css
  204. BIN images/IEpostit.png
  205. BIN images/banner.png
  206. BIN images/bg.png
  207. BIN images/burning_book.jpg
  208. BIN images/close.gif
  209. BIN images/close2.gif
  210. BIN images/loading.gif
  211. BIN images/macFFBgHack.png
  212. BIN images/monitor_overlay.png
  213. BIN images/postit.png
  214. +124 −0 index.html
  215. +13 −0 js/back.js
  216. +543 −0 js/jquery.cluetip.js
  217. +128 −0 js/jquery.color.js
  218. +1 −0 js/jquery.cycle.js
  219. +12 −0 js/jquery.dimensions.js
  220. +102 −0 js/jquery.easing.js
  221. +99 −0 js/jquery.greybox2.js
  222. +9 −0 js/jquery.hoverIntent.js
  223. +1 −0 js/jquery.jmap.js
  224. +32 −0 js/jquery.js
  225. +42 −0 js/jquery.lightbox.js
  226. +11 −0 js/jquery.localscroll.js
  227. +10 −0 js/jquery.scrollTo.js
  228. +2 −0 js/jquery.tablesorter.js
  229. +510 −0 js/ui/effects.core.js
  230. +1 −0 js/ui/ui.accordion.js
  231. +1 −0 js/ui/ui.core.js
  232. +1 −0 js/ui/ui.tabs.js
View
23 chapter01/1.1.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 1.1</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Hello World</h1>
+ </div>
+ <div id="sidebar">
+ <h2>Script 1.1</h2>
+ </div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
25 chapter01/1.2.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 1.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Writing to the document window</h1>
+ </div>
+ <div id="sidebar">
+ <h2>Script 1.2</h2>
+ </div>
+ </div>
+ <p>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+ </p>
+</div>
+</body>
+</html>
View
132 chapter01/1.3.html
@@ -0,0 +1,132 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 1.3</title>
+<style type="text/css">
+/*styles for the table on this page*/
+table {
+ border-right: 1px solid #A7A37E;
+ border-bottom: 1px solid #A7A37E;
+}
+td, th {
+ font-size: 1.3em;
+ padding: 3px;
+}
+table th {
+ font-weight: bold;
+ border-bottom: 1px solid #333333;
+ background: url(images/th_bg.png) repeat-x;
+ border-top: 1px solid #333333;
+ padding-top: 4px;
+ border-left: 1px solid #A7A37E;
+}
+td {
+ border-left: 1px solid #A7A37E;
+}
+.even {
+ background-color: #E7F7FF;
+}
+</style>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Striped Tables</h1>
+ <table width="98%" border="0" cellspacing="0" cellpadding="0" class="striped">
+ <thead>
+ <tr>
+ <th scope="col">Product</th>
+ <th scope="col">Cost</th>
+ <th scope="col">Inventory Status</th>
+ <th scope="col">Weight (in lbs.)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Ultra-Glow Hair Spray</td>
+ <td>$20.00</td>
+ <td>in stock</td>
+ <td>.5</td>
+ </tr>
+ <tr>
+ <td>Anodyne 3000</td>
+ <td>$495.00</td>
+ <td>back order</td>
+ <td>350</td>
+ </tr>
+ <tr>
+ <td>Big Foot Hair Dryer</td>
+ <td>$55.00</td>
+ <td>in stock</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>Cat Out of The Hat</td>
+ <td>$15.00</td>
+ <td>back order</td>
+ <td>15</td>
+ </tr>
+ <tr>
+ <td>Tickle Me Elmo</td>
+ <td>$67.00</td>
+ <td>in stock</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>Mens Watch</td>
+ <td>$350.00</td>
+ <td>in stock</td>
+ <td>.5</td>
+ </tr>
+ <tr>
+ <td>Leather Briefcase</td>
+ <td>$150.00</td>
+ <td>in stock</td>
+ <td>7</td>
+ </tr>
+ <tr>
+ <td>Lorem Ipsum</td>
+ <td>$5.00</td>
+ <td>in stock</td>
+ <td>.25</td>
+ </tr>
+ <tr>
+ <td>Dolor Sat</td>
+ <td>$7.50</td>
+ <td>back order</td>
+ <td>.25</td>
+ </tr>
+ <tr>
+ <td>Chicken Gumbo</td>
+ <td>$15.00</td>
+ <td>in stock</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>Another Product</td>
+ <td>$3.00</td>
+ <td>in stock</td>
+ <td>25</td>
+ </tr>
+ <tr>
+ <td>Hat for Cat</td>
+ <td>$5.00</td>
+ <td>back order</td>
+ <td>.75</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div id="sidebar">
+ <h2> Script 1.3</h2>
+ </div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
24 chapter01/complete_1.1.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+alert('hello world');
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Hello World</h1>
+ </div>
+ <div id="sidebar">
+ <h2>Script 1.1</h2>
+ </div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
25 chapter01/complete_1.2.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 1.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Writing to the document window</h1>
+ <script type="text/javascript">
+ document.write('<p>Hello world!</p>');
+ </script>
+ </div>
+ <div id="sidebar">
+ <h2> Script 1.2</h2>
+ </div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
137 chapter01/complete_1.3.html
@@ -0,0 +1,137 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 1.3</title>
+<style type="text/css">
+/*styles for the table on this page*/
+table {
+ border-right: 1px solid #A7A37E;
+ border-bottom: 1px solid #A7A37E;
+}
+td, th {
+ font-size: 1.3em;
+ padding: 3px;
+}
+th {
+ font-weight: bold !important;
+ border-bottom: 1px solid #333333;
+ background: url(images/th_bg.png) repeat-x;
+ border-top: 1px solid #333333;
+ padding-top: 4px;
+ border-left: 1px solid #A7A37E;
+}
+td {
+ border-left: 1px solid #A7A37E;
+}
+.even {
+ background-color: #E7F7FF;
+}
+</style>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="../js/jquery.js"></script>
+<script type="text/javascript">
+$(document).ready(function( ) {
+ $('table.striped tr:even').addClass('even');
+});
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Striped Tables</h1>
+ <table width="98%" border="0" cellspacing="0" cellpadding="0" class="striped">
+ <thead>
+ <tr>
+ <th scope="col">Product</th>
+ <th scope="col">Cost</th>
+ <th scope="col">Inventory Status</th>
+ <th scope="col">Weight (in lbs.)</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Ultra-Glow Hair Spray</td>
+ <td>$20.00</td>
+ <td>in stock</td>
+ <td>.5</td>
+ </tr>
+ <tr>
+ <td>Anodyne 3000</td>
+ <td>$495.00</td>
+ <td>back order</td>
+ <td>350</td>
+ </tr>
+ <tr>
+ <td>Big Foot Hair Dryer</td>
+ <td>$55.00</td>
+ <td>in stock</td>
+ <td>2</td>
+ </tr>
+ <tr>
+ <td>Cat Out of The Hat</td>
+ <td>$15.00</td>
+ <td>back order</td>
+ <td>15</td>
+ </tr>
+ <tr>
+ <td>Tickle Me Elmo</td>
+ <td>$67.00</td>
+ <td>in stock</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>Mens Watch</td>
+ <td>$350.00</td>
+ <td>in stock</td>
+ <td>.5</td>
+ </tr>
+ <tr>
+ <td>Leather Briefcase</td>
+ <td>$150.00</td>
+ <td>in stock</td>
+ <td>7</td>
+ </tr>
+ <tr>
+ <td>Lorem Ipsum</td>
+ <td>$5.00</td>
+ <td>in stock</td>
+ <td>.25</td>
+ </tr>
+ <tr>
+ <td>Dolor Sat</td>
+ <td>$7.50</td>
+ <td>back order</td>
+ <td>.25</td>
+ </tr>
+ <tr>
+ <td>Chicken Gumbo</td>
+ <td>$15.00</td>
+ <td>in stock</td>
+ <td>3</td>
+ </tr>
+ <tr>
+ <td>Another Product</td>
+ <td>$3.00</td>
+ <td>in stock</td>
+ <td>25</td>
+ </tr>
+ <tr>
+ <td>Hat for Cat</td>
+ <td>$5.00</td>
+ <td>back order</td>
+ <td>.75</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ <div id="sidebar">
+ <h2>Script 1.3</h2>
+ </div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
BIN chapter01/images/even_td_bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN chapter01/images/th_bg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
27 chapter02/2.1.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 2.1</title>
+
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+</head>
+
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Using a Variable</h1>
+ </div>
+ <div id="sidebar">
+ <h2>Script 2.1</h2>
+ </div>
+ </div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
31 chapter02/2.2.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 2.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+
+</script>
+</head>
+
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Using a Variable, Part II</h1>
+ <script type="text/javascript">
+
+ </script>
+ </div>
+ <div id="sidebar">
+ <h2>Script 2.2</h2>
+ </div>
+ </div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
31 chapter02/2.3.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 2.3</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+
+</script>
+</head>
+
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Creating Arrays</h1>
+ <script type="text/javascript">
+
+ </script>
+ </div>
+ <div id="sidebar">
+ <h2>Script 2.3</h2>
+ </div>
+ </div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
105 chapter02/array_methods.html
@@ -0,0 +1,105 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Array Test Bed</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="../js/jquery.js"></script>
+<script type="text/javascript">
+$(document).ready(function( ) {
+ $('.example').each(function() {
+ $this = $(this); // reference to the p tag
+ //alert($this.find('a').html());
+ $this.find('a').click(function() {
+ codeElem = $(this).prev('code');
+ var code = codeElem.text();
+ var expl = codeElem.attr('title') || 'none';
+ results(code,expl);
+ });
+ });
+
+
+
+});
+
+var items = ['shoes', 'socks', 'belt', 'hat'];
+
+function results(code,expl) {
+ if (items[0]!=undefined) {
+ $('#start code').html(items.toString());
+ } else {
+ $('#start code').html('<strong>empty array</strong>');
+ }
+ $('#code code').html(code);
+ var originalItems = items.toString();
+ var returnVal = eval(code);
+ if (items[0]!=undefined) {
+ if (originalItems==items.toString()) {
+ $('#finish code').html('<strong>Array unchanged</strong>');
+ } else {
+ $('#finish code').html(items.toString());
+ }
+ } else {
+ $('#finish code').html('<strong>empty array</strong>');
+ }
+ if (returnVal) {
+ $('#return code').html(returnVal.toString());
+ } else {
+ $('#return code').html('nothing returned');
+ }
+
+ $('#explanation span').html(expl);
+ }
+
+
+
+ </script>
+</head>
+
+<body id="twoCol" onLoad="results('var items = [\'shoes\', \'socks\', \'belt\', \'hat\']');">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1> Array Test Bed</h1>
+ <h2>Original Array</h2>
+ <p class="example"><code title="Initializes array with 4 items">items = ['shoes', 'socks', 'belt', 'hat'];</code>
+ <a href="#">Run It</a> </p>
+ <h2>Splice</h2>
+ <p class="example"><code title="removes 3rd item, and inserts two new items">items.splice(2,1,'coat','scarf');</code> <a href="#">Run It</a> </p>
+ <h2>Push</h2>
+ <p class="example"><code title="adds two items to end of array and returns total number of items in array">items.push('umbrella','shirt');</code> <a href="#">Run It</a></p>
+ <h2>Unshift</h2>
+ <p class="example"><code title="adds two items to beginning of array and returns total number of items in array">items.unshift('tie','pants');</code> <a href="#">Run It</a> </p>
+ <h2>Shift</h2>
+ <p class="example"><code title="removes 1 item from the beginning of the array">items.shift();</code> <a href="#">Run It</a> </p>
+ <h2>Pop</h2>
+ <p class="example"><code title="removes 1 item from end of array">items.pop();</code> <a href="#">Run It</a></p>
+ <h2></h2>
+ <h2>Slice</h2>
+<p class="example"><code title="creates a new array made up of a 'slice' of the original array. The first number is the starting index, the second number is the ending index">items.slice(1,2);</code>
+ <a href="#">Run It</a></p>
+<h2>Reverse</h2>
+<p class="example"><code title="reverses the order of the items in the array">items.reverse();</code>
+ <a href="#">Run It</a></p>
+<h2>Join</h2>
+<p class="example"><code title="creates a string by combining the value of each array item. The string given to the join() command is used as the seperator">items.join(':');</code>
+ <a href="#">Run It</a></p>
+<div id="results"><h2>Results</h2>
+<div id="start">items[] contents at start: <code>&nbsp;</code></div>
+<div id="code">JavaScript code: <code>&nbsp;</code></div>
+<div id="finish">items[] contents after JavaScript: <code>&nbsp;</code></div>
+<div id="return">Returned value: <code>&nbsp;</code></div>
+<div id="explanation">Explanation: <br><span class="explanation">&nbsp;blah</span></div>
+</div>
+ </div>
+ <div id="sidebar">
+ <h2>Array Test Bed</h2>
+ </div>
+ </div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
34 chapter02/complete_2.1.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 2.1</title>
+
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+</head>
+
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Using a Variable</h1>
+ <script type="text/javascript">
+ var firstName = 'Cookie';
+ var lastName = 'Monster';
+ document.write('<p>');
+ document.write(firstName + ' ' + lastName);
+ document.write('</p>');
+ </script>
+ </div>
+ <div id="sidebar">
+ <h2>Script 2.1</h2>
+ </div>
+ </div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
28 chapter02/complete_2.2.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 2.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+var name = prompt('What is your name?', '');
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Using a Variable, Part II</h1>
+ <script type="text/javascript">
+ document.write('<p>Welcome ' + name + '</p>');
+ </script>
+ </div>
+ <div id="sidebar">
+ <h2>Script 2.1</h2>
+ </div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
42 chapter02/complete_2.3.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Script 2.3</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+var authors = [ 'Ernest Hemingway',
+ 'Charlotte Bronte',
+ 'Dante Alighieri',
+ 'Emily Dickinson'
+ ];
+</script>
+</head>
+
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="Quis Nostrud" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Creating Arrays</h1>
+ <script type="text/javascript">
+ document.write('<p>The first author is <strong>');
+ document.write(authors[0] + '</strong></p>');
+ document.write('<p>The last author is <strong>');
+ document.write(authors[authors.length-1] + '</strong></p>');
+ authors.unshift('Stan Lee');
+ document.write('<p>I almost forgot <strong>');
+ document.write(authors[0]);
+ document.write('</strong></p>');
+ </script>
+ </div>
+ <div id="sidebar">
+ <h2>Script 2.3</h2>
+ </div>
+ </div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
31 chapter03/3.1.html
@@ -0,0 +1,31 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 3.1</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+<div id="contentWrap">
+<div id="main">
+<h1>Using Conditional Statements </h1>
+<p>
+<script type="text/javascript">
+
+</script>
+</p>
+</div>
+ <div id="sidebar">
+ <h2>Script 3.1</h2>
+</div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
30 chapter03/3.2.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 3.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>A Basic Function</h1>
+ <p>Today is <strong></strong></p>
+</div>
+
+ <div id="sidebar">
+ <h2>Script 3.2</h2>
+</div>
+</div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
34 chapter03/3.3.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 3.3</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+<div id="contentWrap">
+<div id="main">
+<h1>A Simple Quiz</h1>
+<p>
+<script type="text/javascript">
+
+</script>
+</p>
+</div>
+
+ <div id="sidebar">
+ <h2>Script 3.3</h2>
+</div>
+</div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
42 chapter03/complete_3.1.html
@@ -0,0 +1,42 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 3.1</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+var luckyNumber = prompt('What is your lucky number?','');
+luckyNumber = parseInt(luckyNumber);
+if (isNaN(luckyNumber)) {
+ luckyNumber = prompt('Please, tell me your lucky number.','');
+}
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Using Conditional Statements </h1>
+ <p>
+ <script type="text/javascript">
+ if (luckyNumber == 7 ) {
+ document.write("Hey, that's my lucky number too!");
+ } else if (luckyNumber == 13 || luckyNumber == 24) {
+ document.write("Wooh. " + luckyNumber + "? That's an unlucky number!");
+ } else {
+ document.write("The number " + luckyNumber + " is lucky for you!");
+ }
+ </script>
+ </p>
+</div>
+ <div id="sidebar">
+ <h2>Script 3.1</h2>
+</div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
33 chapter03/complete_3.2.html
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 3.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+function printToday() {
+ var today = new Date();
+ document.write(today.toDateString());
+}
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>A Basic Function</h1>
+ <p>Today is <strong><script type="text/javascript">printToday();</script></strong></p>
+</div>
+
+ <div id="sidebar">
+ <h2>Script 3.2</h2>
+</div>
+</div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
61 chapter03/complete_3.3.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 3.3</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+var score = 0; // initial score is 0
+var questions = [
+ ['How many moons does Earth have?', 1],
+ ['How many moons does Saturn have?',31],
+ ['How many moons does Venus have?', 0]
+ ];
+
+
+//go through the list of questions and ask each one
+for (var i=0; i<questions.length; i++) {
+ askQuestion(questions[i]);
+}
+
+//function for asking question
+function askQuestion(question) {
+ var answer = prompt(question[0],'');
+ if (answer == question[1]) {
+ alert('Correct!');
+ score++;
+ } else {
+ alert('Sorry. The correct answer is ' + question[1]);
+ }
+}
+
+
+
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>A Simple Quiz</h1>
+ <p>
+ <script type="text/javascript">
+ var message = '최종 점수 ' + score;
+ message += ' / 전체 ' + questions.length;
+ document.write(message);
+ </script>
+ </p>
+</div>
+
+ <div id="sidebar">
+ <h2>Script 3.3</h2>
+</div>
+</div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
41 chapter03/complete_do_while.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 3.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+do {
+ var luckyNumber = prompt('What is your lucky number?','');
+ luckyNumber = parseInt(luckyNumber);
+} while (isNaN(luckyNumber));
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Using a Do/While Loop</h1>
+ <p>
+ <script type="text/javascript">
+ if (luckyNumber == 7 ) {
+ document.write("Hey, that's my lucky number too!");
+ } else if (luckyNumber == 13 || luckyNumber == 24) {
+ document.write("Wooh. " + luckyNumber + "? That's an unlucky number!");
+ } else {
+ document.write("The number " + luckyNumber + " is lucky for you!");
+ }
+ </script>
+ </p>
+</div>
+ <div id="sidebar">
+ <h2>Do/While Example</h2>
+</div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
34 chapter04/4.1.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 4.1</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Today&#8217;s Date</h1>
+ <p>
+ <script type="text/javascript">
+ var today = new Date();
+ var message = dateString(today, 'Today is %M %d%o, %Y');
+ document.write(message);
+ </script>
+ </p>
+</div>
+ <div id="sidebar">
+ <h2>Script 4.1</h2>
+</div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
88 chapter04/complete_4.1.html
@@ -0,0 +1,88 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 4.1</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+function dateString(date,string) {
+ /* key for creating string
+ %Y = 2008
+ %y = 08
+ %M = January
+ %m = Jan
+ %N = 01 (month)
+ %n = 1 (month)
+ %W = Monday
+ %w = Mon
+ %D = 05 (day of month)
+ %d = 5 (day of month)
+ */
+ var year=date.getFullYear();
+ var month=date.getMonth();
+ var realMonth=month+1;
+ var fillMonth
+ if (realMonth<10) {
+ fillMonth = '0' + realMonth;
+ } else {
+ fillMonth = realMonth;
+ }
+ var months = ['January','February','March','April','May',
+ 'June','July','August','September',
+ 'October','November','December'];
+ var monthName=months[month];
+ var day=date.getDate();
+ var fillDate
+ if (day<10) {
+ fillDate='0' + day;
+ } else {
+ fillDate=day;
+ }
+ var weekday=date.getDay();
+ var weekdays = ['Sunday','Monday','Tuesday','Wednesday',
+ 'Thursday','Friday','Saturday'];
+ var dayName=weekdays[weekday];
+
+
+ //year
+ string = string.replace(/%Y/g,year); // 2008
+ string = string.replace(/%y/g,year.toString().slice(-2)); //08
+ //month
+ string = string.replace(/%M/g,monthName); //January
+ string = string.replace(/%m/g,monthName.slice(0,3)); //Jan
+ string = string.replace(/%N/g,fillMonth); // 01
+ string = string.replace(/%n/g,realMonth); // 1
+ //day of week
+ string = string.replace(/%W/g,dayName); //Monday
+ string = string.replace(/%w/g,dayName.slice(0,3)); //Mon
+ //day of month
+ string = string.replace(/%D/g,fillDate); //05
+ string = string.replace(/%d/g,day); // 5
+ return string;
+ }
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Today&#8217;s Date</h1>
+ <p>
+ <script type="text/javascript">
+ var today = new Date();
+ var message = dateString(today, 'Today is %W, %M %D, %Y');
+ document.write(message);
+ </script>
+ </p>
+</div>
+ <div id="sidebar">
+ <h2>Script 4.1</h2>
+</div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
32 chapter04/dateString.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 4.1</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="dateString.js"></script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Today&#8217;s Date</h1>
+ <p>
+ <script type="text/javascript">
+ var today = new Date();
+ var message = dateString(today, 'Today is %W, the %O of %M, %Y');
+ document.write(message);
+ </script>
+ </p>
+</div>
+ <div id="sidebar">
+ <h2>Script 4.1</h2>
+</div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
52 chapter04/dateString.js
@@ -0,0 +1,52 @@
+function dateString(date,string) {
+ /* key for creating string
+ %Y = 2008
+ %y = 08
+ %M = January
+ %m = Jan
+ %N = 01 (month)
+ %n = 1 (month)
+ %W = Monday
+ %w = Mon
+ %D = 05 (day of month)
+ %d = 5 (day of month)
+ %O = ordinal like 'st' for 1st, or 'th' for 5th
+ Example: '%W, the %d%O of %M, %Y' will return a string like
+ 'Tuesday, the 6th of February, 2009'
+ */
+ var months = ['January','February','March','April','May',
+ 'June','July','August','September',
+ 'October','November','December'];
+ var days = ['Sunday','Monday','Tuesday','Wednesday',
+ 'Thursday','Friday','Saturday'];
+ var day=date.getDay();
+ var year=date.getFullYear();
+ var month=date.getMonth();
+ var realMonth=month+1;
+ var fillMonth = (realMonth<10) ? '0' + realMonth : realMonth;
+ var date=date.getDate();
+ var fillDate = (date<10) ? '0' + date : date;
+ var sfx = ["th","st","nd","rd"];
+ var val = date%100;
+ var ordDate = date + (sfx[(val-20)%10] || sfx[val] || sfx[0]);
+
+
+ //year
+ string = string.replace(/%Y/g,year); // 2008
+ string = string.replace(/%y/g,year.toString().slice(-2)); //08
+ //month
+ string = string.replace(/%M/g,months[month]); //January
+ string = string.replace(/%m/g,months[month].slice(0,3)); //Jan
+ string = string.replace(/%N/g,fillMonth); // 01
+ string = string.replace(/%n/g,realMonth); // 1
+ //day of week
+ string = string.replace(/%W/g,days[day]); //Monday
+ string = string.replace(/%w/g,days[day].slice(0,3)); //Mon
+ //day of month
+ string = string.replace(/%D/g,fillDate); //05
+ string = string.replace(/%d/g,date); // 5
+ //ordinal (1st) to day
+ string = string.replace(/%O/ig,ordDate);
+ return string;
+ }
+
View
24 chapter04/example_regex.txt
@@ -0,0 +1,24 @@
+US Zip Code REGEX
+var ZipCode = /\d{5}(-\d{4})?/;
+if you want to make sure the string ONLY contains a Zip Code use the ^ and $ to match the beginning and ending of the string like this:
+var ZipCode = /^\d{5}(-\d{4})?$/;
+
+US Phone Number REGEX
+var phoneNum = /\(?(\d{3})\)?[ -.](\d{3})[ -.](\d{4})/;
+if you want to make sure the string ONLY contains a phone number use the ^ and $ to match the beginning and ending of the string like this:
+var ZipCode = /^\(?(\d{3})\)?[ -.](\d{3})[ -.](\d{4})$/;
+
+Email Address REGEX
+var email = /[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}/;
+if you want to make sure the string ONLY contains an email address use the ^ and $ to match the beginning and ending of the string like this:
+var email = /^[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}$/;
+
+Date REGEX
+var date = /([01]?\d)[-\/ .]([0123]?\d)[-\/ .](\d{4})/;
+if you want to make sure the string ONLY contains a date use the ^ and $ to match the beginning and ending of the string like this:
+var date = /^([01]?\d)[-\/ .]([0123]?\d)[-\/ .](\d{4})$/;
+
+URL REGEX
+var URL = /((\bhttps?:\/\/)|(\bwww\.))\S*/;
+if you want to make sure the string ONLY contains a URL use the ^ and $ to match the beginning and ending of the string and remove the \b characters like this:
+var URL = /^((https?:\/\/)|(www\.))\S*$/;
View
29 chapter04/printTime.js
@@ -0,0 +1,29 @@
+function printTime(secs) {
+ var sep = ':'; //seperator character
+ var hours,minutes,seconds,time;
+ var now = new Date();
+ hours = now.getHours();
+ if (hours < 12) {
+ meridiem = 'am';
+ } else {
+ meridiem = 'pm';
+ }
+ hours = hours % 12;
+ if (hours==0) {
+ hours = 12;
+ }
+ time = hours
+ minutes = now.getMinutes();
+ if (minutes<10) {
+ minutes = '0' + minutes;
+ }
+ time += sep + minutes;
+ if (secs) {
+ seconds = now.getSeconds();
+ if (seconds<10) {
+ seconds = '0' + seconds;
+ }
+ time += sep + seconds
+ }
+ return time + ' ' + meridiem;
+}
View
3 chapter04/random.js
@@ -0,0 +1,3 @@
+function rndNum(from, to) {
+ return Math.floor((Math.random()*(to-from+1))+from);
+}
View
196 chapter04/regex_tester.html
@@ -0,0 +1,196 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Regular Expression Tester</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<style type="text/css">
+#resultSection { display:none; }
+</style>
+<script type="text/javascript" src="../js/jquery.js"></script>
+<script type="text/javascript">
+$(document).ready(function() {
+ var regObject = {};
+
+ function displayResults(message) {
+ if ($('#resultSection:visible').length==0) $('#resultSection').show();
+ $('#testResults').html('<p>' + message + '</p>');
+ }
+
+ function buildResults() {
+ var resultString="No match"; // default setting
+
+ var formatSearch = regObject.testString.replace(regObject.regex,'<strong class="found">$&</strong>');
+
+
+ switch (regObject.method) {
+ case 'search' :
+ if(regObject.results==-1) break; // no match
+ resultString = 'Found at position ' + regObject.results;
+ resultString += ' in string:<br>' + formatSearch + '';
+ break;
+ case 'match' :
+ if (! regObject.results) break; // no match
+ resultString = '';
+ for (i in regObject.results) {
+ resultString += (i + ':');
+ if (i == 'input') {
+ resultString += (formatSearch);
+ } else {
+ resultString += regObject.results[i];
+ }
+ resultString += '<br>';
+ }
+ break;
+ case 'replace' :
+ if (regObject.results==regObject.testString) break; // no match
+ resultString = '';
+ resultString += regObject.results;
+ break;
+ }
+ var prependString = "Regex: " + regObject.reValue + "<br>";
+ return prependString + resultString;
+ }
+
+
+
+
+ $('#regexTester').submit(function() {
+
+ //get string
+ regObject.testString = $('#string').val();
+
+ //any options
+ regObject.options='';
+ $(':checkbox:checked').each(function() {
+ regObject.options += $(this).val();
+ });
+
+
+ //get regular expression value and convert to regex
+ regObject.reValue = $('#regex').val();
+ try {
+ regObject.regex = new RegExp(regObject.reValue,regObject.options);
+ } catch (e) {
+ displayResults("ERROR IN YOUR REGULAR EXPRESSION<br>" + e);
+ return false;
+ }
+
+ //method
+ regObject.method = $('[name=method]:checked').val();
+
+ //replace
+ if (regObject.method=='replace') {
+ regObject.replaceString = $('#replaceString').val();
+ }
+
+ if (regObject.method=='search') {
+ regObject.results = regObject.testString.search(regObject.regex);
+ } else if (regObject.method=='match') {
+ regObject.results = regObject.testString.match(regObject.regex);
+ } else {
+ regObject.results = regObject.testString.replace(regObject.regex,'<strong class="found">' + regObject.replaceString + "</strong>");
+ }
+ displayResults(buildResults());
+
+
+
+ return false;
+
+ });
+
+ //hide replacement box until needed
+ $('#replaceBox').hide();
+ //show replacement box when replace selected
+ $('#replace').click(function() {
+ $('#replaceBox').show('fast')
+ });
+ //hide replacement box if either of the other two buttons selected
+ $('#search, #match').click(function() {
+ $('#replaceBox').hide('fast')
+ });
+});
+
+
+
+</script>
+<style type="text/css">
+<!--
+.found {
+ color: #F00;
+}
+.medium {
+ width: 50%;
+}
+#replaceBox {
+ font: 1.6em Georgia, "Times New Roman", Times, serif;
+ margin-bottom: 20px;
+}
+-->
+</style>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Regular Expression Tester </h1>
+ <div class="section" id="testSection">
+ <form action="" method="post" name="form1" id="regexTester">
+ <h2>Test</h2>
+ <p>
+ <label for="string" class="label">String to search</label>
+ <textarea name="string" rows="3" class="wide" id="string"></textarea>
+ </p>
+ <p>
+ <label for="regex" class="label">Regular Expression to use</label>
+ <input name="regex" type="text" class="wide" id="regex">
+ </p>
+ <p><span class="label">Method to Use</span>
+ <label>
+ <input name="method" type="radio" id="search" value="search" checked>
+ Search</label>
+ &nbsp;&nbsp;
+ <label>
+ <input type="radio" name="method" id="match" value="match">
+ Match</label>
+ &nbsp;&nbsp;
+ <label>
+ <input type="radio" name="method" id="replace" value="replace">
+ Replace</label>
+ </p>
+ <div id="replaceBox">
+ <label for="replaceString">Replace with:</label>
+ <input name="replaceString" type="text" class="medium" id="replaceString">
+ </div>
+ <p><span class="label">Options</span>
+<label>
+ <input name="case" type="checkbox" id="case" value="i">
+ Case Insensitive</label>
+ &nbsp;&nbsp;
+ <label>
+ <input name="global" type="checkbox" id="global" value="g">
+ Global</label>
+</p>
+
+ <input type="submit" name="button" id="button" value="Run">
+
+ </form>
+ </div>
+ <div class="section" id="resultSection">
+ <h2>Results <small>(Matched text in red)</small></h2>
+ <div id="testResults">&nbsp;</div>
+ </div>
+</div>
+
+ <div id="sidebar">
+ <h2>regex tester</h2>
+</div>
+ </div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
30 chapter04/time.html
@@ -0,0 +1,30 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Displaying Time</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript" src="printTime.js"></script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>Displaying Time</h1>
+ <p>The time is: <strong>
+ <script type="text/javascript">
+ document.write(printTime(true));
+ </script>
+ </strong></p>
+</div>
+ <div id="sidebar">
+ <h2>Displaying Time</h2>
+</div>
+ </div>
+ <div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
62 chapter05/5.1.html
@@ -0,0 +1,62 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 5.1</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<script type="text/javascript">
+var score = 0; // initial score is 0
+var questions = [
+ ['How many moons does Earth have?', 1],
+ ['How many moons does Saturn have?',31],
+ ['How many moons does Venus have?', 0]
+ ];
+
+
+//go through the list of questions and ask each one
+for (var i=0; i<questions.length; i++) {
+ askQuestion(questions[i]);
+}
+
+//function for asking question
+function askQuestion(question) {
+ var answer = prompt(question[0],'');
+ if (answer == question[1]) {
+ alert('Correct!');
+ score++;
+ } else {
+ alert('Sorry. The correct answer is ' + question[1]);
+ }
+}
+
+
+
+</script>
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>A Simple Quiz Revisited</h1>
+ <p>
+ <script type="text/javascript">
+ var message = 'You got ' + score;
+ message += ' out of ' + questions.length;
+ message += ' questions correct.';
+ document.write(message);
+ </script>
+ </p>
+</div>
+
+ <div id="sidebar">
+ <h2>Script 5.1</h2>
+</div>
+</div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
59 chapter05/5.2.html
@@ -0,0 +1,59 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 5.2</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<style type="text/css">
+<!--
+#main h2 {
+ font: bold 30px Tahoma, Geneva, sans-serif;
+ color: #036;
+ border-bottom: 1px solid #666;
+ margin-top:15px;
+ text-transform:uppercase;
+ position:relative
+}
+/* the class to overlay the headlines */
+.headEffect {
+position: absolute;
+width: 100%;
+display: block;
+height:36px;
+background: url(gradient.png) repeat;
+}
+/* for IE 6 only */
+* html .headEffect {
+ background: none;
+ filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='gradient.png', sizingMethod='scale');
+}
+-->
+</style>
+
+</head>
+<body id="twoCol">
+<div id="container">
+ <div id="banner"><img src="../images/banner.png" alt="JavaScript: The Missing Manual" width="760" height="65"><span id="badge"><a href="http://www.sawmac.com/missing/js/"></a></span></div>
+
+ <div id="contentWrap">
+ <div id="main">
+ <h1>jQuery Enhanced Headlines</h1>
+ <h2>A mysterious headline</h2>
+ <p>Mauris imperdiet nisi ut pede. Vivamus nisi lorem, euismod in, fringilla et, porttitor in, nunc. Vivamus metus. </p>
+ <h2>another cool headline</h2>
+ <p>Mauris imperdiet nisi ut pede. Vivamus nisi lorem, euismod in, fringilla et, porttitor in, nunc. Vivamus metus. </p>
+ <h2>The fun just won't stop</h2>
+ <p>Mauris imperdiet nisi ut pede. Vivamus nisi lorem, euismod in, fringilla et, porttitor in, nunc. Vivamus metus. </p>
+ <p>&nbsp;</p>
+</div>
+
+ <div id="sidebar">
+ <h2>Script 5.2</h2>
+</div>
+</div>
+
+<div id="footer"><em>&#8220;Building Interactive Web Sites with JavaScript&#8221;</em></div>
+</div>
+</body>
+</html>
View
55 chapter05/5.3.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+<title>Script 5.3</title>
+<link href="../css/global.css" rel="stylesheet" type="text/css">
+<style type="text/css">
+.pullquote {
+ float: right;
+ clear: right;
+ display: block;
+ width: 200px;
+ border: 1px solid black;
+ padding: 10px;
+ font-size: 20px;
+ background-color:#FFC;