Photoshop web design - 858 Part III . Document Objects Reference Layer

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: From a script in the Head section, the statement that changes the layer s bgColor property is this: document.Flintstones.bgColor = 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 = document.Flintstones.document.lastModified 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 references to items in the second level of layers get even longer. For example, to get the lastModified property of the fredFlintstone.html file loaded into the nested Fred layer, use this reference from the Head script: document.Flintstones.document.Fred.document.lastModified The reason for this is that NN4 does not have a shortcut access to every layer defined in a top-level document. As stated in the description of the document. layers property in Chapter 18, the property reflects only the first level of layers document.layerObject
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Leave a Reply