DHTML Tutorials

Dynamic Content In IE4
Previous Home Next

Changing HTML on the fly in IE (IE4+) is very simple. By using one or more relevant properties, we can assign new HTML or text to any containment element (such as <div> or <span>), and the page is instantly updated and reflowed to show the new content.

In IE 4, dynamic content is realized through a special property called innerHTML that exists on the and tag. you can set this property to a new HTML value, and the contents inside that span or div is instantly updated to the new value. Now we will illustrate how it's done by modifying the above example to create dynamic content for IE 4 users:

HTML elements in IE 4 now all support a style object, which is essentially the "dynamic" object used to manipulate the look and "feel" of that element. In this elements can also be assigned an "id" attribute, which can then be used to identify it during scripting.

The style object contains many properties, and by manipulating these properties, you can alter the look of an element, dynamically. Some of these properties are:

  • backgroundColor The backgound color of the element.
  • backgroundImage The background image of the element.
  • color The color of the element
  • position The position type of the element. Accepted values are "absolute" and relative"
  • pixelWidth The width of the element.
  • pixelTop The position of the element in relation to the y coordinates

Problem

it is possible to spy on the contents of any text and HTML files on somebody else"s computer. Not only local files are in danger, but also data on your company"s intranet - even if it is protected by a firewall.

The security hole exists even if users have activated the highest security level in their browser. The problem affects both the German and the English version of the Internet Explorer.

Syntax

<span id="sometext" 
onMouseover="sometext.style.color='pink'"
onMouseout="sometext.style.color='green'">
Move your mouse here</span>
Previous Home Next