Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
vì vậy đây không phải là một kỹ thuật mà bạn nên sử dụng cho báo cáo kịch bản mà cần phải được gọi bởi nhiều đối tượng. Cũng lưu ý rằng bạn không thể sử dụng sự thay đổi thẻ nếu trình duyệt không phải IE, tiền IE4 tải trang. Trong các trình duyệt như vậy, báo cáo thực hiện kịch bản như trang | 496 Part III Document Objects Reference w ndowOty ect.location.search Passing data among pages via URLs It is not uncommon to want to preserve some pieces of data that exist in one page so that a script in another page can pick up where the script processing left off in the first page. You can achieve persistence across page loads through one of three techniques the document.cookie see Chapter 18 variables in framesetting documents and the search string of a URL. That s really what happens when you visit search and e-commerce sites that return information to your browser. Rather than store say your search criteria on the server they spit the criteria back to the browser as part of the URL. The next time you activate that URL the values are sent to the server for processing for example to send you the next page of search results for a particular query . Passing data among pages is not limited to client server communication. You can use the search string strictly on the client-side to pass data from one page to another. Unless some CGI process on the server is programmed to do something with the search string a Web server regurgitates the search string as part of the location data that comes back with a page. A script in the newly loaded page can inspect the search string via the location.search property and tear it apart to gather the data and put it into script variables. Take a look at Listings 17-6 through 17-8 to see a powerful application of this technique. As mentioned in the opening of Chapter 16 about frames you can force a particular HTML page to open inside the frameset for which it is designed. But with the help of the search string you can reuse the same framesetting document to accommodate any number of content pages that go into one of the frames rather than specifying a separate frameset for each possible combination of pages in the frameset . The listings in this section create a simple example of how to force a page to load in a frameset by passing