tailieunhanh - JavaScript Bible, Gold Edition part 170

JavaScript Bible, Gold Edition part 170. 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-182 Part VI Appendixes Example Use The Evaluator Chapter 13 to clone rename and append an element found in The Evaluator s source code. Begin by cloning the paragraph element named myP along with all of its content. Enter the following statement into the topmost text field a myP .cloneNode true The variable a now holds the clone of the original node so you can change its ID attribute at this point by entering the following statement ID Dolly If you want to see the properties of the cloned node enter a into the lower text field. The precise listing of properties you see depends on whether you use NN or IE in either case you should be able to locate the id property whose value is now Dolly. As a final step append this newly named node to the end of the body element by entering the following statement into the topmost text field a You can now scroll down to the bottom of the page and see a duplicate of the content. But because the two nodes have different ID attributes they cannot confuse scripts that need to address one or the other. componentFromPoint x y NN2 NN3 NN4 NN6 IE3 J1 IE3 J2 IE4 IE5 Compatibility Example You can experiment with this method in the code supplied with Listing 15-24. As presented the method is associated with a TEXTAREA object that is specifically sized to display both vertical and horizontal scrollbars. As you click various areas of the TEXTAREA and the rest of the page the status bar displays information about the location of the event with the help of the componentFromPoint method. The script utilizes a combination of the property and the componentFromPoint method to help you distinguish how you can use each one for different types of event processing. The srcElement property is used initially as a filter to decide whether the status bar will reveal further processing about the TEXTAREA element s event details. e ementOb .

TỪ KHÓA LIÊN QUAN