tailieunhanh - Học JavaScript qua ví dụ part 3

Trình duyệt là gì? Khi người dùng nhận được một trang bao gồm JavaScript, kịch bản được gửi đến các phiên dịch JavaScript, mà thực hiện kịch bản. Bởi vì mỗi trình duyệt đều có thông dịch viên riêng của mình, thường có sự khác biệt trong cách mã sẽ được thực thi. Và như các công ty cạnh tranh cải thiện và sửa đổi trình duyệt của họ, không thống nhất mới có thể xảy ra | What Browser 15 an HTML table and how it is represented as a tree where each element is related to its parent and siblings as described by the W3C shown at http DOM. What Browser When a user receives a page that includes JavaScript the script is sent to the JavaScript interpreter which executes the script. Because each browser has its own interpreter there are often differences in how the code will be executed. And as the competing companies improve and modify their browsers new inconsistencies may occur. There are not only different types of browsers to cause the incompatibilities but also different versions of the same browser. Because modern browsers conform to the W3C standards these inconsistencies tend to be less of a distraction than they were in the past. Popular browsers today are shown in Table . Table Modern Browsers Browser Web Site Internet Explorer windows ie Firefox products firefox Safari safari Opera Google Chrome chrome Konqueror The little script in Example should tell you what browser you are using. Even though the application name might display Netscape for Firefox and Microsoft Internet Explorer for Opera if you examine the user agent you will be able find Firefox or Opera as part of the output string see Figure . Programs that determine the browser type are called browser sniffers. We have a complete example in Chapter 10 It s the BOM Browser Objects. EXAMPLE script type text javascript alert User appName is nUser agent is script From the Library of 16 Chapter 1 Introduction to JavaScript Figure Output from Example . Versions of JavaScript JavaScript has a history. Invented by Netscape the first version was JavaScript . It was new and buggy and has long since been replaced by much cleaner versions. Microsoft has a scripting language comparable to JavaScript called .

TỪ KHÓA LIÊN QUAN