• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Making Content Dynamic > Changing Tag Attribute Values

5.5. Changing Tag Attribute Values

You'd think that with so many HTML tag attributes reflected as scriptable properties, it would be simple enough to modify the look of many elements by adjusting their properties after the document has loaded. Unfortunately for compatibility, of the currently released scriptable browsers, only Internet Explorer 4 lets you adjust highly visible attributes on the fly. This is because the rendering engine in the browser does a nice job of reflowing a page's content in response to a change of any property. Therefore, you can increase the size of an IMG element by altering the height and width properties of the object, and the content around and below the image is shifted to make room for the bigger picture. If you try to do this with Navigator 4, however, a script error message reminds you that these properties are read-only in that browser.

In fact, if you are aiming for cross-platform compatibility in altering the physical appearance of a currently loaded document, your possibilities are very limited. Outside of form element values (e.g., the contents of a text box, selected items in a checkbox, the state of a radio button, and selected list options), about the only tag attributes you can alter from a script in Navigator are the image object's src attribute (as described in the previous section) and the document's bgColor property. Even the document.bgColor property has some caveats when the page is being run in Navigator 2 or 3 on an operating system other than Windows: the color change may obscure other existing content on the page. Other color-related properties of the document object are not settable from a script.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint