Dynamically Changing content

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email
Changing web page content is a great way to provide context-specific information to the user. You make text content changes through a Dynamic HTML mechanism called HTML replacement, The key to HTML replacement is Dynamic HTML's approach to defining the existing HTML tags and text in a text block as an object that you can change dynamically by an on-page script routine.

Every HTML tag pair that can contain text can be used for HTML content replacement, You identify the elements you want to change dynamically by instantiating them as objects through the I D= attribute. You then have four text element properties at your disposal to dynamically change the contents within the element's tag pair. An HTML element tag pair can change the four following properties:

innerHTML
outerHTML
innerText
outerText

You can change any of these HTML element properties by assigning a new text string to the element's property.

For example, if you declare a paragraph, such as the following: <P ID=PG1>I <B>Iove</B><I> Dynamic HTML </I></P>

You can then use the following line in a script function to reference the existing I <B>Iove </B><I>Dynamic HTML </I> HTML tags and text within the paragraph text block and change the contents:

PG1. innerHTML=

as much as 1 <B>Iove </B> breathing";

It is important to understand exactly what an element range defines. An element is any HTML tag or tag pair that is parsed and treated as a unique item on a page. An element differs from an object in that an element is an object only if it is named with an ID attribute. The range is the span of influence an element has within the Web page. The range of a text block or section is defined by the HTML tags and text that appear between the opening and closing tags of the tag pair.

The innerHTML property defines the contents of an element object with HTML tags and maintains the existing tags that define the element. The outerHTML property also defines the contents of an element object with HTML tags, yet replaces the element itself with the outer tags identified in the assignment string.

The innerText property defines new contents of an element, but evaluates the assignment string as text only. The outerText property defines new contents of an element and eliminates the element tags in the process. The outerText property also evaluates the assignment string as text only. Any tags placed in the assignment string will appear as text on the page if you use the innerText or outerText properties.

Therefore, changing the inner HTML property of the PG1 paragraph maintains the <p></p> tag pair as part of the page.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.