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

Làm việc với các đối tượng cửa sổ Các đối tượng cửa sổ là nơi mà tất cả các hành động xảy ra trong trình duyệt. Đó là ở trên cùng của hệ thống phân cấp JavaScript, và được tự động xác định cho mỗi cửa sổ mà bạn mở, như được trình bày trong hình 10,12 | JavaScript and the Browser Object Model 285 Working with the window Object The window object is where all the action happens in a browser. It s at the top of the JavaScript hierarchy and is automatically defined for each window that you open as represented in Figure . When you start up your browser you may stay in the current window until you exit the browser or you may have any number of windows open at the same time. Within each window you browse the Internet read e-mail search for cheap airline tickets and buy a new book. Each new page you bring up is a document within the current window. The window is often partitioned into independent display areas called frames which are windows within windows. Frames are discussed in the section Working with Frames on page 303. The window object comes with a number of properties and methods. Because it is the basis of all objects the name of the window object can be excluded when applying methods to it for example it is not necessary to specify Watch out or OK . You simply use alert Watch out or OK . When a user clicks a button or rolls the mouse over a link an event occurs that often affects the behavior of a window. Such user-initiated events are discussed in Chapter 13 Handling Events. Object s Properties and Methods. The window object has a number of properties which are also objects in their own right. Table lists those properties and how they describe the attributes of the window. Table Properties of the window Object Property What It Describes closed True if the window is closed. defaultStatus The default status message displayed in the status bar at the bottom of the window. document The document object that is currently displayed in the window. frames An array of frame objects within the window. history The history object containing the URLs last loaded into the window. length The number of frames within the window. location The URL of the

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã 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.