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

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

JavaScript Bible, Gold Edition part 181. 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-292 Part VI Appendixes This is an example of how to control a window s position dynamically based on math calculations. IE complicates the job a bit by not providing properties that reveal the outside dimensions of the browser window. To demonstrate the moveBy method the third function zigzag uses a for loop to increment the coordinate points to make the window travel in a saw tooth pattern across the screen. The x coordinate continues to increment linearly until the window is at the edge of the screen also calculated on the fly to accommodate any size monitor . The y coordinate must increase and decrease as that parameter changes direction at various times across the screen. In the fourth function you see some practical code finally that demonstrates how best to simulate maximizing the browser window to fill the entire available screen space on the visitor s monitor. navigate URL NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 IE5.5 Compatibility Example Supply any valid URL as the parameter to the method as in window.navigate http www.dannyg.com open URL windowName windowFeatures replaceFlag NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 IE5.5 Compatibility Example The page rendered by Listing 16-26 displays a single button that generates a new window of a specific size that has only the statusbar turned on. The script here shows all the elements necessary to create a new window that has all the right stuff on most platforms. The new window object reference is assigned to a global variable newWindow. Before a new window is generated the script looks to see if the windowObject.open Appendix F Examples from Parts III and IV CD-293 window has never been generated before in which case newWindow would be null or for newer browsers the window is closed. If either condition is true the window is created with the open method. Otherwise the existing window is brought forward with the focus method NN3 and IE4 . As a safeguard against older browsers the script manually adds an opener .