您的位置:首页 > Web前端 > JavaScript

JavaScript in HTML(Chapter 2 of Professional JavaScript® for Web Developers 2nd Edition)

2011-01-08 13:04 871 查看
  For pages that require a lot of JavaScript code, this can cause a noticeable delay in page rendering, during which time the browser will be completely blank. For this reason, modern web applications typically include all JavaScript references in the <body> element, after the page content.  HTML 4.01 defines an attribute named defer for the <script> element. The purpose of defer is to indicate that a script won ’ t be changing the structure of the page as it executes. As such, the script can be run safely after the entire page has been parsed. Setting the defer attribute on a <script> element effectively is the same as putting the <script> element at the very bottom of the page.  Internet Explorer 5.5 introduced the concept of document modes through the use of doctype switching. The first two document modes were quirks mode , which made IE behave as if it were version 5 (with several nonstandard features), and standards mode , which made IE behave in a more standards - compliant way. Though the primary difference between these two modes is related to the rendering of content with regard to CSS, there are also several side effects related to JavaScript.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐