tailieunhanh - JavaScript Bible, Gold Edition part 102

JavaScript Bible, Gold Edition part 102. 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. | 858 Part III Document Objects Reference Layer references The task of assembling JavaScript references to NN4 layers and the objects they contain resembles the same process for framesets in fact conceptually a layer is like a dynamically movable and resizable free-floating frame . Therefore before you start writing the reference you must know the relationship between the document containing the script and the target of the reference. To demonstrate how this works I start with a script in the base document loaded into a window that needs to change the background color bgColor property of a layer defined in the document. The skeletal HTML is as follows HTML HEAD HEAD BODY LAYER NAME Flintstones SRC LAYER BODY HTML From a script in the Head section the statement that changes the layer s bgColor property is this yellow This syntax looks like the way you address any object in a document such as a link or image. However things get tricky in that each layer automatically contains a document object of its own. That document object is what holds the content of the layer. Therefore if you want to inspect the lastModified property of the HTML document loaded into the layer use this statement var modDate The situation gets more complex if the layer has another layer nested inside it one of those passengers that goes along for the ride . If the structure changes to HTML HEAD HEAD BODY LAYER NAME Flintstones SRC LAYER NAME Fred SRC LAYER LAYER NAME Wilma SRC LAYER LAYER BODY HTML references to items in the second level of layers get even longer. For example to get the lastModified property of the file loaded into the nested Fred layer use this reference from the Head script The reason for this is that NN4 does not have a shortcut access to every .

TỪ KHÓA LIÊN QUAN