`

犀牛书第五版读书笔记——Chapter 13. JavaScript in Web Browsers(第一部分)

阅读更多
1.在客户端javascript中,Document对象表示HTML文档,Window对象表示显示文档的浏览器窗口

2.Window是客户端中的global object,非常重要。包括alert()等方法,document等属性,都是window对象的属性

3.Window对象有2个属性指向自身,分别是window和self,用任何一个都可以获取window对象

4.在一个window中声明的全局变量,不是另一个window中的全局变量,因为不同的window有不同的global object。不过,有途径让另一个window中的javascript代码获取到第一个window中的全局变量

5.客户端javascript采用的是事件驱动的编程模型。当一个事件发生时,浏览器尝试调用合适的事件处理函数来响应这个事件。所以,为了编写动态交互的客户端javascript程序,需要定义合适的事件处理器,并注册到系统中,这样的话,浏览器就可以在合适的时间调用它们了

6.业界提倡编写非侵入的javascript代码。应该做到,将javascript代码写在单独的js文件里,再引入html;事件处理函数用js代码注册,而不是直接写在html中;将js代码分模块进行组织;即使js代码不可用,页面的功能依然可用,等等

7.将javascript代码嵌入html有多种方式,推荐的方式是
<script src="../../scripts/util.js"></script>

8.用<src>方式引入的外部js文件,效果就如同直接用<script>写入一样。所以在同一个页面中引入的多个js文件,它们是可以共享变量的,但是要注意变量冲突的问题

9.当包含javscript代码的HTML文件被读入浏览器的时候,javascript代码即被执行

10.javascript代码可以直接写在url中,但这种方式很不好,应该尽量避免

11.出现在<script>中的javascript语句是按照它们出现的顺序执行的。当一个文件包含多个script,则这些脚本按照它们出现的顺序依次执行。javascript代码的执行,是html文档读取和解析的过程的一部分
分享到:
评论

相关推荐

    HTML5 and JavaScript Web Apps【PDF新书】

    Chapter 1. Client-Side Architecture Chapter 2. The Mobile Web Chapter 3. Building for the Mobile Web Chapter 4. The Desktop Web Chapter 5. WebSockets Chapter 6. Optimizing with Web Storage Chapter 7. ...

    JavaScript权威指南(第6版).JavaScript:The.Definitive.Guide

    Chapter 13 JavaScript in Web Browsers Chapter 14 The Window Object Chapter 15 Scripting Documents Chapter 16 Scripting CSS Chapter 17 Handling Events Chapter 18 Scripted HTTP Chapter 19 The jQuery ...

    JavaScript权威指南(第6版)--JavaScript:The.Definitive.Guide

    Chapter 13 JavaScript in Web Browsers Chapter 14 The Window Object Chapter 15 Scripting Documents Chapter 16 Scripting CSS Chapter 17 Handling Events Chapter 18 Scripted HTTP Chapter 19 The jQuery ...

    JavaScript权威指南第五版【新】(犀牛书)

    这本最畅销的JavaScript参考书的第四版已经进行了全面的更新,其中涵盖JavaScript 1.5(ECMAScript Version 3)的详细介绍。它还提供了W3C DOM标准(1级和2级)的完整内容,为了向后兼容,本书保持了遗留的O级DOM的资料...

    JavaScript权威指南

    JavaScript权威指南 犀牛书 Chapter 1. Introduction to JavaScript Section 1.1. JavaScript Myths Section 1.2. Versions of JavaScript Section 1.3. Client-Side JavaScript Section 1.4. JavaScript ...

    [removed] Moving to ES2015 (AZW3格式)

    Chapter 1. Javascript Primer Chapter 2. Functions, Closures, And Modules Chapter 3. Data Structures And Manipulation Chapter 4. Object-Oriented Javascript Chapter 5. Javascript Patterns Chapter 6. ...

    Beginning.JavaScript.5th.Edition

    Chapter 1: Introduction To Javascript And The Web Chapter 2: Data Types And Variables Chapter 3: Decisions And Loops Chapter 4: Functions And Scope Chapter 5: Javascript-An Object-Based Language ...

    Node.js.for.Embedded.Systems

    By bringing accessibility to embedded components such as sensors and microcontrollers, JavaScript and Node.js might shape the world of physical computing as they did for web browsers. This practical ...

    JavaScript权威指南(第6版)

    Chapter 13 JavaScript in Web Browsers Chapter 14 The Window Object Chapter 15 Scripting Documents Chapter 16 Scripting CSS Chapter 17 Handling Events Chapter 18 Scripted HTTP Chapter 19 The jQuery ...

    javascript权威指南(第六版)

    13. JavaScript in Web Browsers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 13.1 Client-Side JavaScript 307 13.2 Embedding JavaScript in HTML 311 13.3 ...

    Professional JavaScript for Web Developers英文版

    the-fly graphicsJavaScript API changes in HTML5how browsers handle JavaScript errors and error handlingfeatures of JavaScript used to read and manipulate XML datathe JSON data format as an alternative...

    Mastering.JavaScript.High.Performance.1784397296

    Build faster and more proficient JavaScript programs for web browsers and hybrid mobile apps Step-by-step tutorial stuffed with real-world examples Who This Book Is For If you are a JavaScript ...

    Client-Side.Data.Storage.Keeping.It.Local.14919

    Chapter 1. A Gentle Introduction to Client-Side Data Storage Chapter 2. Working with Cookies Chapter 3. Working with Web Storage Chapter 4. Working with IndexedDB Chapter 5. Working with Web SQL ...

    Beginning JavaScript 4th Edition Oct 2009

    You'll get all-new coverage of Ajax for remote scripting, JavaScript frameworks, JavaScript and XML, and the latest features in modern Web browsers. Plus, all the featured code has been updated to ...

    Mastering.JavaScript.1785281348

    The majority of websites employ JavaScript, and it is well supported by all modern web browsers without plugins. However, the JavaScript landscape has changed dramatically in recent years, and you ...

    Wrox.Professional.Website.Performance.2013

    Chapter 1. A Refresher on Web Browsers Chapter 2. Utilizing Client-Side Caching Chapter 3. Content Compression Chapter 4. Keeping the Size Down with Minification Chapter 5. Optimizing Web Graphics and...

    Professional Mobile Web Development with WordPress, Joomla! and Drupal.pdf

    CHAPTER 1 Introducing the Mobile Web . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 CHAPTER 2 A Technical Overview of the Mobile Web . . . . . . . . . . . . . . . . . ...

    Jump Start HTML5

    Chapter 1. Basics: What is HTML5? Chapter 2. Basics: The Anatomy of HTML5 Chapter 3. Basics: Structuring Documents Chapter 4. Basics: HTML5 Forms Chapter 5. Basics: Multimedia, Audio and Video Chapter...

    Web Browsers

    Web Browsers, A web browser is the software program you use to access the World Wide Web, the graphical portion of the Internet. The first browser, called NCSA Mosaic, was developed at the National ...

    ppk on Javascript (pdf)

    Chapter 1. Purpose Section A. Conceptual overview Section B. Technical overview Section C. JavaScript history Chapter 2. Context Section A. The CSS revolution Section B. Separation of ...

Global site tag (gtag.js) - Google Analytics