spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / dhtml / column5
Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

Logo

Dynamic Content in IE4:
the new properties for replacing and deleting text and HTML

With Apologies to Charlie

To best demonstrate the use of the new properties, we will use this piece of HTML:

which, when parsed, renders:

It was the best of times, it was the worst of times, it was the age of wisdon, it was the age of foolishness...

The second named element in the above passage is goodTimes, assigned to a B tag.

This element can be referenced as:

As we know, the all collection of the document object contains all the elements in a page. For this reason, it is redundant as a reference. When dealing with cross-browser code, it is usually maintained to allow for comparison with Navigator's document object. Since this is IE-specific code, we'll do away with it. Thus, the first element can be simply referenced as goodTimes, and the four properties in question as:

These properties have the following string values:

(The example again: the <B ID="goodTimes"><I>best</I></B> of times,)

The values of these properties can be both retrieved and set. That is, they are read/write properties.

Notice that innerText and outerText have the same value. All HTML has been stripped, as the "text" properties see only the non-HTML text..

Assigning a string value to any of these properties through a script will cause the page to be immediately updated to accomodate the changes.

Note:

We now know how these properties obtain their initial values. We can, however, change these values at will


Produced by Peter Belesis and

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business

All Rights Reserved. Legal Notices.
Created: 09/24/97
Revised: 09/28/97

URL: http://www.webreference.com/dhtml/column5/inANDout.html