1 / 68

Chapter 12 - JavaScript: Objects

Chapter 12 - JavaScript: Objects. Outline 12.1 Introduction 12.2 Thinking About Objects 12.3 Math Object 12.4 String Object 12.4.1 Fundamentals of Characters and Strings 12.4.2 Methods of the String Object 12.4.3 Character-Processing Methods 12.4.4 Searching Methods

Télécharger la présentation

Chapter 12 - JavaScript: Objects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 12 - JavaScript: Objects Outline 12.1 Introduction 12.2 Thinking About Objects 12.3 MathObject 12.4 StringObject 12.4.1 Fundamentals of Characters and Strings 12.4.2 Methods of theStringObject 12.4.3 Character-Processing Methods 12.4.4 Searching Methods 12.4.5 Splitting Strings and Obtaining Substrings 12.4.6 XHTML Markup Methods 12.5 DateObject 12.6 BooleanandNumberObjects 12.7 documentObject 12.8 windowObject 12.9 Using Cookies 12.10 Final JavaScript Example 12.11 Web Resources

  2. 12.1  Introduction • Use JavaScript to manipulate every element of XHTML document from a script • Reference for several of JavaScript’s built-in objects • Demonstrates the capabilities

  3. 12.2  Thinking About Objects • Objects • Attributes • Behaviors • Encapsulate date and methods • Property of information hiding • Details hidden within the objects themselves

  4. 12.3  Math Object • Allow the programmer to perform many common mathematical calculations

  5. 12.3  Math Object Fig. 12.1 Math object methods.

  6. 12.3  Math Object

  7. 12.3  Math Object

  8. 12.4  String Object • JavaScript’s string and character-processing capabilities • Appropriate for processing names, addresses, credit card information, etc.

  9. 12.4.1 Fundamentals of Characters and Strings • Characters • Fundamental building blocks of JavaScript programs • String • Series of characters treated as a single unit

  10. 12.4.2 Methods of the String Object Fig. 12.3 Stringobject methods.

  11. 12.4.2 Methods of the String Object Fig. 12.3 Stringobject methods.

  12. 12.4.2 Methods of the String Object

  13. 12.4.3 Character Processing Methods • charAt • Returns the character at specific position • charCodeAt • Returns Unicode value of the character at specific position • fromCharCode • Returns string created from series of Unicode values • toLowerCase • Returns lowercase version of string • toUpperCase • Returns uppercase version of string

  14. CharacterProcessing.html1 of 2

  15. CharacterProcessing.html2 of 2

  16. 12.4.4 Searching Methods • indexOf and lastIndexOf • Search for a specified substring in a string

  17. SearchingStrings.html1 of 3

  18. SearchingStrings.html2 of 3

  19. SearchingStrings.html3 of 3

  20. 12.4.5 Splitting Strings and Obtaining Substrings • Tokenization • The process of breaking a string into tokens • Tokens • Individual words • Separated by delimiters

  21. SplitAndSubString.html1 of 2

  22. SplitAndSubString.html2 of 2

  23. 12.4.6 XHTML Markup Methods • Anchor • <a name = “top”>Anchor</a> • Blink • <blink>blinking text</blink> • Fixed • <tt>monospaced text</tt> • Strike • <strike> strike out text </strike> • Subscript • <sub> subscript </sub> • Superscript • <sup> superscript </sup>

  24. MarkupMethods.html1 of 2

  25. MarkupMethods.html2 of 2

  26. 12.5  Date Object • Provides methods for date and time manipulations

  27. 12.5  Date Object

  28. 12.5  Date Object

  29. 12.5  Date Object

  30. DateTime.html1 of 3

  31. DateTime.html2 of 3

  32. DateTime.html3 of 3

  33. 12.6  Boolean and Number Objects • Object wrappers for boolean true/false values and numbers

  34. 12.6  Boolean and Number Objects

  35. 12.6  Boolean and Number Objects

  36. 12.7  document Object • Manipulate document that is currently visible in the browser window

  37. 12.7  document Object

  38. 12.8  window Object • Provides methods for manipulating browser window

  39. window.html1 of 7

  40. window.html2 of 7

  41. window.html3 of 7

  42. window.html4 of 7

  43. window.html5 of 7

  44. window.html6 of 7

  45. window.html7 of 7

  46. 12.8  window Object

More Related