Học JavaScript qua ví dụ part 31

JavaScript Object Browser và các Model các chương trình JavaScript được kết hợp với một cửa sổ trình duyệt và tài liệu hiển thị trong cửa sổ. cửa sổ này là một đối tượng trình duyệt và tài liệu là một đối tượng HTML. Trong mô hình đối tượng trình duyệt, đôi khi được gọi là Hội đồng quản trị, cửa sổ là ở phía trên của cây, và dưới nó là các đối tượng: cửa sổ, hoa, khung [], tài liệu, lịch sử, vị trí, và màn hình | chapter 10 It s the BOM Browser Objects JavaScript and the Browser Object Model JavaScript programs are associated with a browser window and the document displayed in the window. The window is a browser object and the document is an HTML object. In the browser object model sometimes called BOM the window is at the top of the tree and below it are objects window navigator frames document history location and screen. See Figure . Figure The hierarchy of the browser object model. If you are writing a JavaScript program that needs to manipulate the window then you would use the window object and properties and methods associated with it. For example the status property of the window object is used when you want to display text in the status bar and the window s alert method allows you to send a message to a dialog box. The document object model refers to the HTML document and all the elements and attributes associated with it. Because your Web page is so closely linked to HTML or XML JavaScript uses the DOM to access the HTML elements and attributes within a page. The document is the root of this model. Each HTML element is assigned to an object There are 271 From the Library of 272 Chapter 10 It s the BOM Browser Objects image objects form objects link objects and so on see Figure . See Chapter 11 Working with Forms and Input Devices for more on document objects and the DOM. document Document object 1 1 1 1 1 links array of Link objects anchors array of Anchor objects forms array of Form objects images array of Image objects applets array of applet objects embeds array of embedded objects Figure The hierarchy of the document object model. By combining the browser and document object models JavaScript allows you to manipulate all of the elements in a page as objects from the window down the hierarchy as shown in Figure . Current Window 1 1 1 1 1 self window parent top Window objects navigator Navigator object frames Array of .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.