Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
 Discussion Forums
 HTML, XML, JavaScript...
 Software Reviews
 Editors,Others...
 Top100
 JavaScript Tutorials, ...
 Tutorials
 ASP, CSS, Databases...
 Discussion List
 FAQ, Roundup, Configure ...
 Authoring
 HTML, JavaScript, CSS...
 Design
 Layout, Navigation,...
 Graphics
 Tools, Colors, Images...
 Software
 Browsers, Editors, XML...
 Internet
 Domains, E-Commerce, ...
 WDVL Resources
  Intermdiate, Tutorials,...
 WDVL
 Discussion Lists, Top 100,...
 Technology Jobs


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Top 10 Articles
  1. Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions
  2. JavaScript Tutorial for Programmers
  3. Design
  4. JavaScript Tutorial for Programmers - Objects
  5. JavaScript Tutorial for Programmers - JavaScript Grammar
  6. JavaScript Tutorial for Programmers - Versions of JavaScript
  7. Cascading Style Sheets
  8. JavaScript Tutorial for Programmers - Embedding JavaScript
  9. JavaScript Tutorial for Programmers - Functions
  10. Authoring JavaScript
Domain Name Lookup
Search to find the availability of a domain name. Just enter the complete domain name with extension (.com, .net, .edu)

DHTML in IE 4

August 21, 2000

As I began taking on and learning IE 4's implementation of DHTML, I realized that there's a lot more to it than its NS counterpart. DHTML in IE does not rely on any one tag, but rather, new objects and properties that stem out of the usual HTML tags you're used to working with, such as <div> and <table>. It's a lot more powerful, but at the same time, and lot more complicated to grasp. 

-The style object of IE 4

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. Like the <layer> tag, elements can also be assigned an "id" attribute, which can then be used to identify it during scripting. For example:

<div id="adiv"></div>

In your script, the syntax required to access the style object of "adiv" would look like this:

adiv.style

The style object contains many properties, and by manipulating these properties, you can alter the look of an element, dynamically. I'll show some of these properties now:

Important properties of the style object
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
pixelHeight The height of the element
pixelLeft The position of the element in relation to the x coordinates
pixelTop The position of the element in relation to the y coordinates

The properties above only represent a subset of the total supported properties, but are the most commonly used ones. The basic syntax to manipulating any style property is the same, which I'll show in a minute. By accessing these properties, we can change the look and style of most HTML elements (as opposed to just the <layer> tag in Netscape)!

Here's a simple demonstration. The below text changes color when the mouse moves over it:

Move your mouse here

Here's the source code to the above text:

<span id="sometext"
onMouseover="sometext.style.color='red'"
onMouseout="sometext.style.color='black'">Move your mouse here</span>

Notice how I changed the text's color:

sometext.style.color='red'

I first used the element's id to gain access to it, then, through the style object and finally the style's color property, I was able to easily change the color of the text on demand!

All style properties are read/write, and are accessed in a similar manner: element id->style object->property name.

Hers's another example that expands an image when the mouse is over it, and reverts it back to its original size when the mouse moves out:

<img id="aimage" k
	src	= "piza.gif"
	alt	= ""
onMouseover="enlarge()" onMouseout="revertback()">

<script language="JavaScript1.2">
function enlarge(){
aimage.style.pixelWidth=164
aimage.style.pixelHeight=202
}

function revertback(){
aimage.style.pixelWidth=82
aimage.style.pixelHeight=101
}
</script>

Yes, I know its not exactly the most practical example in the world, but it does illustrate DHTML at work quite well. The image changes dimensions on demand, without the need to reload the document. That's something JavaScript alone can never do.

DHTML in NS- The <layer> tag
Beginner's Guide to DHTML
Dynamic Content


Up to => Home / Quadzilla / DHTML




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers