Đang chuẩn bị liên kết để tải về tài liệu:
JavaScript Bible, Gold Edition part 21

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

JavaScript Bible, Gold Edition part 21. This book will bring programmers and non-technical professionals, including casual programmers and scripters, painlessly up to speed on all aspects of mastering JavaScript. Key topics include programming fundamentals, JavaScript language elements and how to use them effectively, and how to easily and efficiently add powerful new functionality to HTML documents and Java applets. | 48 Part III Document Objects Reference Listing 13-3 A Branching Index Page HTML HEAD TITLE GiantCo On The Web TITLE SCRIPT LANGUAGE JavaScript -- window.location.href home1.html -- SCRIPT META HTTP-EQUIV REFRESH CONTENT O URL http www.giantco.com home2.html HEAD BODY CENTER A HREF home2.html IMG SRC images giantcoLogo.gif HEIGHT 60 WIDTH 120 BORDER O ALT Go To GiantCo Home Page A CENTER BODY HTML Notice that the only visible content is an image surrounded by a standard link. The BODY tag contains no background color or art. A single script statement is located in the Head. A META tag is also in the Head to automate navigation for some users. To see how a variety of browsers respond to this page here are what three different classes of browser do with Listing 13-3 A JavaScript-enabled browser. Although the entire page may load momentarily at most flashing the company logo for a brief moment the browser executes the script statement that loads home1.html into the window. In the meantime the image is preloaded into the browser s memory cache. This image should be reused in home1.html so the download time isn t wasted on a one-time image. If your pages require a specific browser brand or minimum version number this is the place to filter out browsers that don t meet the criteria which may include the installation of a particular plug-in . Use the properties of the navigator object Chapter 28 to write a browser sniffer script that allows only those browsers meeting your design minimum to navigate to the scripted home page. All other browsers fall through to the next execution possibility. A modern browser with JavaScript turned off or missing. Several modern browsers recognize the special format of the META tag as one that loads a URL into the current window after a stated number of seconds. In Listing 13-3 that interval is zero seconds. The META tag is executed only if the browser ignores the SCRIPT tag. Therefore any scriptable browser that has JavaScript turned off .