JavaScript & DHTML Cookbook(第二版,影印版)
JavaScript & DHTML Cookbook(第二版,影印版)
Danny Goodman
出版时间:2008年03月
页数:582
在当今Web 2.0的世界里,JavaScript和动态HTML处于热门新方法的中心,用来设计客户端的高度交互页面。考虑到现实情况,新版《JavaScript & DHTML Cookbook》为网络开发人员经常碰到的各种非常特殊的脚本问题提供了易于理解的解决方案。每个实例包括一段有针对性的代码,你可以立刻将其嵌入到你的应用程序当中。

在经过数年的时间读过几千个论坛的讨论之后,本书作者同时也是脚本编程先锋的Danny Goodman汇集了一个问题清单,这些问题经常让各种经验程度的脚本语言开发人员都觉得烦恼。对于他提到的每个问题,Goodman不仅提供代码,也阐释解决方法如何生效以及为什么可行。书中的实例涵盖各个方面,从简单任务,如使用JavaScript操作字符串和验证日期,到展示复杂任务的全套程序库,如跨浏览器定位HTML元素、排序表以及在客户端实现Ajax功能。

本书包括150多个实例,同时针对新手和有经验的脚本开发人员:
* 用交互的表单和样式表工作
* 提供用户友好的页面导航
* 通过文档对象模型(Document Object Model)脚本制作动态内容
* 为静态内容添加视觉效果
* 在浏览器中使用XML数据工作

本书对上一版使用的很多实例都进行了修订,帮助你构建可扩展的Web 2.0用户界面,并添加了一些新的实例以提供客户端Ajax解决方案。本书中的每一个实例都符合最新的W3C标准,兼容各种浏览器,包括Internet Explorer 7、Firefox 2、Safari和Opera 9。

如果你想编写自己的脚本并理解它们的内部机制,而不是仅仅依赖于一个商业化的网络开发框架,这本《JavaScript & DHTML Cookbook》就是必备书籍。

Danny Goodman从20世纪70年代后期就开始为个人计算机和电子消费产品写作。在以后的岁月里,他最受欢迎的书籍 —— 关于HyperCard、AppleScript、JavaScript以及动态HTML —— 已经涵盖了各种编程环境,它们对于业余爱好者而言易于理解,对于专家而言也仍然足够强劲。他的《Dynamic HTML权威参考》目前已更新至第三版,是O'Reilly的最畅销书籍之一。
  1. Preface
  2. 1. Strings
  3. 1.1 Concatenating (Joining) Strings
  4. 1.2 Improving String Handling Performance
  5. 1.3 Accessing Substrings
  6. 1.4 Changing String Case
  7. 1.5 Testing Equality of Two Strings
  8. 1.6 Testing String Containment Without Regular Expressions
  9. 1.7 Testing String Containment with Regular Expressions
  10. 1.8 Searching and Replacing Substrings
  11. 1.9 Using Special and Escaped Characters
  12. 1.10 Reading and Writing Strings for Cookies
  13. 1.11 Converting Between Unicode Values and String Characters
  14. 1.12 Encoding and Decoding URL Strings
  15. 1.13 Encoding and Decoding Base64 Strings
  16. 2. Numbers and Dates
  17. 2.1 Converting Between Numbers and Strings
  18. 2.2 Testing a Number’s Validity
  19. 2.3 Testing Numeric Equality
  20. 2.4 Rounding Floating-Point Numbers
  21. 2.5 Formatting Numbers for Text Display
  22. 2.6 Converting Between Decimal and Hexadecimal Numbers
  23. 2.7 Generating Pseudorandom Numbers
  24. 2.8 Calculating Trigonometric Functions
  25. 2.9 Creating a Date Object
  26. 2.10 Calculating a Previous or Future Date
  27. 2.11 Calculating the Number of Days Between Two Dates
  28. 2.12 Validating a Date
  29. 3. Arrays and Objects
  30. 3.1 Creating a Simple Array
  31. 3.2 Creating a Multidimensional Array
  32. 3.3 Converting Between Arrays and Strings
  33. 3.4 Doing Something with the Items in an Array
  34. 3.5 Sorting a Simple Array
  35. 3.6 Combining Arrays
  36. 3.7 Dividing Arrays
  37. 3.8 Creating a Custom Object
  38. 3.9 Simulating a Hash Table for Fast Array Lookup
  39. 3.10 Doing Something with a Property of an Object
  40. 3.11 Sorting an Array of Objects
  41. 3.12 Customizing an Object’s Prototype
  42. 3.13 Converting Arrays and Custom Objects to Strings
  43. 3.14 Using Objects to Reduce Naming Conflicts
  44. 4. Variables, Functions, and Flow Control
  45. 4.1 Creating a JavaScript Variable
  46. 4.2 Creating a Named Function
  47. 4.3 Nesting Named Functions
  48. 4.4 Creating an Anonymous Function
  49. 4.5 Delaying a Function Call
  50. 4.6 Branching Execution Based on Conditions
  51. 4.7 Handling Script Errors Gracefully
  52. 4.8 Improving Script Performance
  53. 5. Browser Feature Detection
  54. 5.1 Detecting the Browser Brand
  55. 5.2 Detecting an Early Browser Version
  56. 5.3 Detecting the Internet Explorer Version
  57. 5.4 Detecting the Mozilla Version
  58. 5.5 Detecting the Safari Version
  59. 5.6 Detecting the Opera Version
  60. 5.7 Detecting the Client Operating System
  61. 5.8 Detecting Object Support
  62. 5.9 Detecting Object Property and Method Support
  63. 5.10 Detecting W3C DOM Standard Support
  64. 5.11 Detecting the Browser Written Language
  65. 5.12 Detecting Cookie Availability
  66. 5.13 Defining Browser- or Feature-Specific Links
  67. 5.14 Testing on Multiple Browser Versions
  68. 6. Managing Browser Windows
  69. 6.1 Living with Browser Window Control Limitations
  70. 6.2 Setting the Main Window’s Size
  71. 6.3 Positioning the Main Window
  72. 6.4 Maximizing the Main Window
  73. 6.5 Creating a New Window
  74. 6.6 Bringing a Window to the Front
  75. 6.7 Communicating with a New Window
  76. 6.8 Communicating Back to the Main Window
  77. 6.9 Using Internet Explorer Modal/Modeless Windows
  78. 6.10 Simulating a Cross-Browser Modal Dialog Window
  79. 6.11 Simulating a Window with Layers
  80. 7. Managing Multiple Frames
  81. 7.1 Creating a Blank Frame in a New Frameset
  82. 7.2 Changing the Content of One Frame from Another
  83. 7.3 Changing the Content of Multiple Frames at Once
  84. 7.4 Replacing a Frameset with a Single Page
  85. 7.5 Avoiding Being “Framed” by Another Site
  86. 7.6 Ensuring a Page Loads in Its Frameset
  87. 7.7 Reading a Frame’s Dimensions
  88. 7.8 Resizing Frames
  89. 7.9 Setting Frameset Specifications Dynamically
  90. 8. Dynamic Forms
  91. 8.1 Auto-Focusing the First Text Field
  92. 8.2 Performing Common Text Field Validations
  93. 8.3 Preventing Form Submission upon Validation Failure
  94. 8.4 Auto-Focusing an Invalid Text Field Entry
  95. 8.5 Using a Custom Validation Object 208
  96. 8.6 Changing a Form’s Action
  97. 8.7 Blocking Submissions from the Enter Key
  98. 8.8 Advancing Text Field Focus with the Enter Key
  99. 8.9 Submitting a Form by an Enter Key Press in Any Text Box
  100. 8.10 Disabling Form Controls
  101. 8.11 Hiding and Showing Form Controls
  102. 8.12 Allowing Only Numbers (or Letters) in a Text Box
  103. 8.13 Auto-Tabbing for Fixed-Length Text Boxes
  104. 8.14 Changing select Element Content
  105. 8.15 Copying Form Data Between Pages
  106. 9. Managing Events
  107. 9.1 Equalizing the IE and W3C Event Models
  108. 9.2 Initiating a Process After the Page Loads
  109. 9.3 Appending Multiple Load Event Handlers
  110. 9.4 Determining the Coordinates of a Click Event
  111. 9.5 Preventing an Event from Performing Its Default Behavior
  112. 9.6 Blocking Duplicate Clicks
  113. 9.7 Determining Which Element Received an Event
  114. 9.8 Determining Which Mouse Button Was Pressed
  115. 9.9 Reading Which Character Key Was Typed
  116. 9.10 Reading Which Noncharacter Key Was Pressed
  117. 9.11 Determining Which Modifier Keys Were Pressed During an Event
  118. 9.12 Determining the Element the Cursor Rolled From/To
  119. 9.13 Synchronizing Sounds to Events
  120. 10. Page Navigation Techniques
  121. 10.1 Loading a New Page or Anchor
  122. 10.2 Keeping a Page Out of the Browser History
  123. 10.3 Using a select Element for Navigation
  124. 10.4 Passing Data Between Pages via Cookies
  125. 10.5 Passing Data Between Pages via Frames
  126. 10.6 Passing Data Between Pages via URLs
  127. 10.7 Creating a Contextual (Right-Click) Menu
  128. 10.8 Creating Drop-Down Navigation Menus
  129. 10.9 Providing Navigation Trail Menus
  130. 10.10 Creating Expandable Menus
  131. 10.11 Creating Collapsible XML Menus
  132. 11. Managing Style Sheets
  133. 11.1 Assigning Style Sheet Rules to an Element Globally
  134. 11.2 Assigning Style Sheet Rules to a Subgroup of Elements
  135. 11.3 Assigning Style Sheet Rules to an Individual Element
  136. 11.4 Importing External Style Sheets
  137. 11.5 Importing Browser- or Operating System-Specific Style Sheets
  138. 11.6 Changing Imported Style Sheets After Loading
  139. 11.7 Enabling/Disabling Style Sheets
  140. 11.8 Toggling Between Style Sheets for an Element
  141. 11.9 Overriding a Style Sheet Rule
  142. 11.10 Turning Arbitrary Content into a Styled Element
  143. 11.11 Creating Center-Aligned Body Elements
  144. 11.12 Reading Effective Style Sheet Property Values
  145. 11.13 Forcing Recent Browsers into Standards-Compatibility Mode
  146. 12. Visual Effects for Stationary Content
  147. 12.1 Precaching Images
  148. 12.2 Swapping Images (Rollovers)
  149. 12.3 Reducing Rollover Image Downloads with JavaScript
  150. 12.4 Reducing Rollover Image Downloads with CSS
  151. 12.5 Dynamically Changing Image Sizes
  152. 12.6 Changing Text Style Properties
  153. 12.7 Offering Body Text Size Choices to Users
  154. 12.8 Creating Custom Link Styles
  155. 12.9 Changing Page Background Colors and Images
  156. 12.10 Hiding and Showing Elements
  157. 12.11 Adjusting Element Transparency
  158. 12.12 Creating Transition Visual Effects
  159. 12.13 Drawing Charts in the Canvas Element
  160. 13. Positioning HTML Elements
  161. 13.1 Making an Element Positionable in the Document Space
  162. 13.2 Connecting a Positioned Element to a Body Element
  163. 13.3 Controlling Positioning via a DHTML JavaScript Library
  164. 13.4 Deciding Between div and span Containers
  165. 13.5 Adjusting Positioned Element Stacking Order (Z-order)
  166. 13.6 Centering an Element on Top of Another Element
  167. 13.7 Centering an Element in a Window or Frame
  168. 13.8 Determining the Location of a Nonpositioned Element
  169. 13.9 Animating Straight-Line Element Paths
  170. 13.10 Animating Circular Element Paths
  171. 13.11 Creating a Draggable Element
  172. 13.12 Scrolling div Content
  173. 13.13 Creating a Custom Scrollbar
  174. 13.14 Creating a Slider Control
  175. 14. Creating Dynamic Content
  176. 14.1 Writing Dynamic Content During Page Loading
  177. 14.2 Creating New Page Content Dynamically
  178. 14.3 Including External HTML Content
  179. 14.4 Embedding XML Data
  180. 14.5 Embedding Data As JavaScript Objects
  181. 14.6 Transforming XML Data into HTML Tables
  182. 14.7 Transforming JavaScript Objects into HTML Tables
  183. 14.8 Converting an XML Node Tree to JavaScript Objects
  184. 14.9 Creating a New HTML Element
  185. 14.10 Creating Text Content for a New Element
  186. 14.11 Creating Mixed Element and Text Nodes
  187. 14.12 Inserting and Populating an iframe Element
  188. 14.13 Getting a Reference to an HTML Element Object
  189. 14.14 Referencing All Elements of the Same Class
  190. 14.15 Replacing Portions of Body Content
  191. 14.16 Removing Body Content
  192. 14.17 Using XMLHttpRequest for a REST Request
  193. 14.18 Using XMLHttpRequest for a SOAP Call
  194. 14.19 Sorting Dynamic Tables
  195. 14.20 Walking the Document Node Tree
  196. 14.21 Capturing Document Content
  197. 15. Dynamic Content Applications
  198. 15.1 Displaying a Random Aphorism
  199. 15.2 Converting a User Selection into an Arbitrary Element
  200. 15.3 Automating the Search-and-Replace of Body Content
  201. 15.4 Designing a User-Editable Content Page
  202. 15.5 Creating a Slide Show
  203. 15.6 Auto-Scrolling the Page
  204. 15.7 Greeting Users with Their Time of Day
  205. 15.8 Displaying the Number of Days Before Christmas
  206. 15.9 Displaying a Countdown Timer
  207. 15.10 Creating a Calendar Date Picker
  208. 15.11 Displaying an Animated Progress Bar
  209. A. Keyboard Event Character Values
  210. B. Keyboard Key Code Values
  211. C. ECMAScript Reserved Keywords
  212. Index
书名:JavaScript & DHTML Cookbook(第二版,影印版)
作者:Danny Goodman
国内出版社:东南大学出版社
出版时间:2008年03月
页数:582
书号:978-7-5641-1140-3
原版书出版商:O'Reilly Media
Danny Goodman
 
Danny Goodman从20世纪70年代末就开始撰写关于个人电脑和商业电子产品的内容。2006年是他的自由撰稿人和程序员生涯的第25年,这些年来他发表了数百篇杂志文章,几个商业软件产品,以及包括本书在内共45本计算机书籍。多年来,他在HyperCard、AppleScript、JavaScript和DynamicHTML方面的著作广为流传,这些书籍提供了非专业程序员也能使用的编程环境,而强大的内容也吸引了许多专家。他的《Dynamic HTML: The Definitive Reference》已经出了第3版,是O'Reilly销量最好的书籍之一。