tailieunhanh - JavaScript Bible, Gold Edition part 19

JavaScript Bible, Gold Edition part 19. 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. | CD-110 Part II JavaScript Tutorial and set the image s border to zero or attach a client-side image map to it. The combination of a link and image is how you make a clickable image button the image type of form input element is not a scriptable object until IE4 and NN6 . Interchangeable images The advantage of having a scriptable image object is that a script can change the image occupying the rectangular space already occupied by an image. In IE4 and NN6 the images can even change size with surrounding content reflowing accordingly. The script behind this kind of image change is simple enough. All it entails is assigning a new URL to the image object s src property. The size of the image on the page is governed by the HEIGHT and WIDTH attributes set in the IMG tag as the page loads. The most common image rollovers use the same size image for each of the rollover states. In NN3 and NN4 the image can t change size on the page which causes a differently sized replacement image to scale to fit the original dimensions. Precaching images Images often take several extra seconds to download from a Web server. If you design your page so an image changes in response to user action you usually want the same fast response that users are accustomed to in multimedia programs. Making the user wait many seconds for an image to change can severely detract from enjoyment of the page. JavaScript comes to the rescue by enabling scripts to load images into the browser s memory cache without displaying the image a technique called precaching images. The tactic that works best is to preload the image into the browser s image cache when the page initially loads. Users are less impatient for those few extra seconds as the main page loads than waiting for an image to download in response to some mouse action. Precaching an image requires constructing an image object in memory. An image object created in memory differs in some respects from the document image object that you create with the

TỪ KHÓA LIÊN QUAN