tailieunhanh - Học JavaScript qua ví dụ part 34
Làm việc với các khung hình Khi bạn nhìn ra ngoài cửa sổ trong phòng, nơi bạn có thể vào lúc này, nó có thể là một tấm kính lớn giống như một cửa sổ hình ảnh, hoặc cửa sổ có thể được chia ra thành các tấm hình vuông hoặc hình chữ nhật. Trình duyệt là một cửa sổ ảo có thể được chia thành các khung cửa sổ độc lập, giống như tấm, bên trong cửa sổ chính, nơi mỗi khung được sử dụng để hiển thị thông tin khác nhau. Phát minh bởi Netscape, khung hình cho phép. | JavaScript and the Browser Object Model 303 Figure This is the scene that will be scrolling by in the small window above. Working with Frames When you look out the window in the room where you might be at the moment it might be one big pane of glass like a picture window or the window might be divided up into panes of squares or rectangles. The browser is a virtual window that can be divided up into frames independent windows like panes within the main window where each frame is used to display different information. Invented by Netscape frames allow you to display more than one Web page in the same window. Web designers have debated the merit of using frames because they are often misused but have some distinct disadvantages discussed later in this chapter. The file that defines the layout of the frames is called the parent window and each of the frames it describes is called a child see Figure . Although you can t see the parent window it will show up in the browser s source for the page. Parent or Top Window Child Frame Child Frame Child Child Frame Frame Figure The parent window is divided into child frames. To build frames in a Web page you use the HTML frameset tags instead of the body tags see Table . At least three files are needed to create frames. The first file defines the layout of the frames or subwindows by defining the size and position From the Library of 304 Chapter 10 It s the BOM Browser Objects of the frames. The rows and cols attributes of each frameset specify how much room the frame will need within the window. These values use exact pixels as a default although you can also use percentages to represent a section of the window or an asterisk to allocate leftover space. These size values will be shown in Examples and . Creating HTML Frames. In Example the window is divided into two frames a left frame that takes up 25 percent in columns of the window and a right frame that takes
đang nạp các trang xem trước