出版時(shí)間:2009-7 出版社:東南大學(xué)出版社 作者:Sbelley Powers 頁(yè)數(shù):375
Tag標(biāo)簽:無(wú)
前言
JavaScript was originally intended to be a scripting interface between a web page loadedin the browser client (Netscape Navigator at the time) and the application on the server.Since its introduction in 1995, JavaScript has become a key component of web devel-opment, and has found uses elsewhere as well.This book covers the JavaScript language, from its most primitive data types that havebeen around since the beginning of the language, to its most complex features, includ-ing those that have to do with Ajax and dynamic page effects. After reading this book,you will have the basics you need to work with even the most sophisticated librariesand web applications.AudienceReaders of this book should be familiar with web page technology, including CascadingStyle Sheets (CSS) and HTML/XHTML. Previous programming experience isn'trequired, though some sections may require extra review if you have no previousexposure to programming.This book should help:Anyone who wants, or needs, to integrate JavaScript into his own personal websiteor sitesAnyone who uses a content-management tool, such as a weblogging tool, andwants to better understand the scripting components incorporated into her tooltemplatesWeb developers who seek to integrate JavaScript and some of the dynamic webpage/Ajax features into their websitesWeb service developers who want to develop for a new market of clientsTeachers who use web technologies as either the focus or a component of theircourses
內(nèi)容概要
如果你想使用JavaScript來(lái)利用當(dāng)今強(qiáng)大的瀏覽器,《學(xué)習(xí)JavaScript》為這個(gè)Web開發(fā)中奇妙且不可缺少的語(yǔ)言提供了完整而實(shí)際的指導(dǎo)。你將會(huì)學(xué)習(xí)從原始數(shù)據(jù)類型到復(fù)雜特性的所有內(nèi)容,包括與Ajax和動(dòng)態(tài)頁(yè)面效果有關(guān)的JavaScript元素。學(xué)完這本書,你將能夠使用最復(fù)雜的程序庫(kù)和Web應(yīng)用程序?! 〉诙嬷邪嗽S多JavaScript運(yùn)用中的最佳實(shí)踐和范例,展示了如何將語(yǔ)言和瀏覽器環(huán)境整合,以及如何為符合標(biāo)準(zhǔn)的Web站點(diǎn)實(shí)踐準(zhǔn)確的編碼技術(shù)。 有了這本書,你將能夠: 學(xué)習(xí)JavaScript應(yīng)用程序結(jié)構(gòu),包括基本語(yǔ)句和控制結(jié)構(gòu); 識(shí)別JavaScript對(duì)象:String、Number、Boolean、Function等; 使用瀏覽器調(diào)試工具和故障檢測(cè)技術(shù); 理解事件處理、表單事件和帶有表單的JavaScript應(yīng)用程序; 使用瀏覽器對(duì)象模型(BOM)、文檔對(duì)象模型(DOM)和自定義對(duì)象進(jìn)行開發(fā); 學(xué)習(xí)關(guān)于瀏覽器cookies和更多最新的客戶端存儲(chǔ)技術(shù); 利用Ajax應(yīng)用程序得到使用XML和JSON的詳細(xì)信息?! 秾W(xué)習(xí)JavaScript》遵循已被證實(shí)的學(xué)習(xí)原理,幫助你以簡(jiǎn)單的步驟吸收這些原理,以使你理解如何在各種瀏覽器中建立強(qiáng)大且反應(yīng)迅速的應(yīng)用程序。
作者簡(jiǎn)介
作者:(美國(guó))Sbelley Powers
書籍目錄
Preface1. Hello JavaScript! Hello World! Hello World! Once Again The script Tag JavaScript Versus ECMAScript Versus JScript Defining Functions in JavaScript Event Handlers The document Browser Object The property Operator The var Keyword and Scope Statements Comments What You Didn't See: HTML Comments and CDATA Sections. JavaScript Files Accessibility and JavaScript Best Practices Accessibility Guidelines noscript2. JavaScript Data Types and Variables Identifying Variables Naming Guidelines Primitive Types The String Data Type String Escape Sequences String Encoding Converting to Strings The Boolean Data Type The Number Data Type The null and undefined Variables Constants: Named but Not Variables Test Your Knowledge: Quiz Test Your Knowledge: Answers3. Operat0rs and Statements The Format of a JavaScript Statement The Assignment Statement The Arithmetic Operators The Unary Operators Operator Precedence A Handy Shortcut: Assignment with Operation The Bitwise Operators Conditional Statements and Program Flow The if...else Conditional Statement The switch Conditional Statement The Conditional Operators The Equality and Identity (String Equality) Operators Other Relational Operators The One and Only JavaScript Ternary Operator The Logical Operators Advanced Statements: The Loops The while Loop The do...while Loop The for Loops Test Your Knowledge: Quiz Test Your Knowledge: Answers4. The JavaScript Objects Primitive Data Types As Objects Boolean, Number, and String The Boolean Object The Number Object, Static Properties, and Instance Methods The String Object Regular Expressions and RegExp The RegExp Methods: test and exec Working with Regular Expressions The Date Object The Math Object The Math Properties The Math Methods JavaScript Arrays FIFO Queues Test Your Knowledge: Quiz Test Your Knowledge: Answers5. Functions Declarative Functions Function Naming Conventions and Size Function Returns and Arguments Anonymous Functions Function Literals Functions and Recursion Nested Functions, Function Closure, and Memory Leaks Callback Functions Function Type Summary Function Scope Function As Object Test Your Knowledge: Quiz Test Your Knowledge: Answers6. Troubleshooting, Debugging, and Cross-Browser Issues Simple Ways to Debug Development and Debugging Tools by Browser Firefox and Firebug Using console.log Firefox, the Web Developer Toolkit, and NoScript Opera and Dragonfly Safari/WebKit and the Web Inspector Internet Explorer Dealing with Cross-Browser Differences Object Detection Where Object Detection Fails DOCTYPE, X-UA-Compatible, and Quirks Mode Breaking Backward Compatibility: The IE8 http-equiv Meta Tag Test Your Knowledge: Quiz Test Your Knowledge: Answers7. Catching Events The Events Level 0 Event Handling The Event Object Event Bubbling Event Handlers and this The DOM Level 2 Event Model Generating Events Test Your Knowledge: Quiz Test Your Knowledge: Answers8. Forms, Form Events, and Validation Attaching Events to Forms: Different Approaches Cross-Browser Event Handling Canceling an Event Selection Dynamically Modifying the Selection Selection and Auto-Selection Radio Buttons and Checkboxes The text, textarea, password, and hidden Input Elements Text Validation Input Fields and Regular Expression Validation Forms, the Sandbox, and XSS Test Your Knowledge: Quiz Test Your Knowledge: Answers9. Browser As Puzzle Box The Structure of the Browser at a Glance The window Object Creating and Controlling Windows The Dialogs: alert, confirm, and prompt Creating Custom Windows Modifying a Window Frames The location Object Remote Scripting with the iframe Adding and Controlling Timers The history, screen, and navigator Objects The history Object The screen Object The navigator Object The history, screen, and navigator Properties in Action The Document Object Links Images innerHTML Test Your Knowledge: Quiz Test Your Knowledge: Answers10. Cookies and Other Client-Side Storage Techniques The JavaScript Sandbox and Cookie Security The Same-Origin Security Policy Using document.domain All About Cookies Storing and Reading Cookies Flash Shared Objects, Google Gears, and HTML5 DOM Storage Test Your Knowledge: Quiz Test Your Knowledge: Answers11. The DOM, or Web Page As Tree A Tale of Two Interfaces The DOM HTML API The DOM HTML Objects and Their Properties DOM (HTML) Collections Understanding the DOM: The Core API The DOM Tree Node Properties and Methods The DOM Core Document Object Element and Access in Context Modifying the Tree Test Your Knowledge: Quiz Test Your Knowledge: Answers12. Dynamic Pages JavaScript, CSS, and the DOM The Style Property/Attributes Fonts and Text Font Style Properties Text Properties Position and Movement Dynamic Positioning Drag-and-Drop Size and Clipping Overflow and Dynamic Content The Clipping Rectangle Display, Visibility, and Opacity The Right Tool for the Right Effect Just-in-Time Information Revisiting the DOM: Collapsing Forms, Query Selectors, and Class Names Test Your Knowledge: Quiz Test Your Knowledge: Answers13. Creating Custom lavaScript Objects The JavaScript Object and Prototyping Prototyping Creating Your Own Custom JavaScript Objects Enter the Function Public and Private Properties and Where this Enters the Picture Getters and Setters Object Encapsulation Chaining Constructors and JavaScript Inheritance One-Off Objects Object Libraries: Packaging Your Objects for Reuse Advanced Error Handling Techniques (try, throw, catch) Test Your Knowledge: Quiz Test Your Knowledge: Answers14. Moving Outside the Page with Ajax How Ajax Works Hello Ajax World! The XMLHttpRequest Object and Preparing to Send the Request Object, Object, Who Has the Object? The XMLHttpRequest Methods Processing the Web Request Return Checking the readyState and status of an Ajax Request Processing the Web Request Result Ajax: It's Not Only Code The Dynamic Nature of Ajax Ajax Accessibility and Degrading Gracefully Security and Workarounds JavaScript and Ajax Libraries Test Your Knowledge: Quiz Test Your Knowledge: Answers15. Ajax Data: XML oriSON? XML-Formatted Ajax Results The Data's MIME Type Generating the XML on the Server Processing the XML on the Client JavaScript Object Notation A Simple JSON Application The JSON Object Test Your Knowledge: Quiz Test Your Knowledge: AnswersIndex
章節(jié)摘錄
插圖:Using the object property approach, you don't have to add event handlers as attributesinto element tags, but instead can add them into the JavaScript itself. We'll get intomore details on event handlers and more advanced forms of event handling beginningin Chapter 7. In the meantime, let's take a closer look at the document object.The document Browser ObjectExample 1-2, as small as it is, used one of the most powerful objects available in yourbrowser: the document object. The document object is, for all intents and purposes, arepresentation of the page, including all of the elements within it. It's through thedocument that we can access the page contents, and as you've just seen, it's through thedocument that we can also modify the page contents.The document has collections mapped to page elements, such as all the images or formelements in the page. It also has methods that you can use to both access and alter theweb page, including the open, writein, and dose methods used in Example 1-2.The open method opens the document for writing. In Example 1-2, the documentopened was the same document with which the script is contained. The writein methodis a variation of the write method, which outputs a string of text to the document. Theonly difference between write and writeln is that writein also appends a newline char-acter following the text. The dose method closes the document, and also forces theimmediate rendering of the document contents.An unfortunate consequence of writing to the existing document after the page is loadedis that the existing contents of the document are erased. That's why when you openthe page you'll see the "Hello, World!" message but you won't see the "Hi" that'salready in the page.
編輯推薦
《學(xué)習(xí)JavaScript(影印版)》是由東南大學(xué)出版社出版的。
圖書封面
圖書標(biāo)簽Tags
無(wú)
評(píng)論、評(píng)分、閱讀與下載