DHTML behaviors, a new feature in Microsoft's Internet Explorer 5.0 Developer's Preview, make Dynamic HTML functionality more accessible and easier to use in a document. A DHTML behavior component can be written in many scripting languages, including JScript or VB Script, and supplies dynamic functionality that can be applied to any element in an HTML document through the use of Cascading Style Sheets (CSS).
You may have noticed as the page was loading how this paragraph flew into place. DHTML behaviors like this use CSS to separate the script from the content and style of documents. Isolating functionality in this way is known to developers as "encapsulation", it brings the benefits of object reuse to the world of DHTML.
So how do you declare and use DHTML behaviors in a Web page? If you know how to use CSS, you know how to use DHTML behaviors. It really is that easy. As proposed to the World Wide Web Consortium(W3C) by Microsoft, a new CSS property called behavior would define the location of the behavior component. Be forewarned that behaviors are merely a proposal at this point, and are not a part of any Document Object Model standard, and are only available with IE5.
In the sample above, the script that implements the "flying" effect is encapsulated in a separate file. You may obtain the Microsoft public domain fly scriptlet by right-clicking and choosing Save Target As. To use the fly-in behavior, simply wrap the HTML content to be animated within <IE5:fly> tags as demonstrated below.
Did you find this tip helpful? Let me know by sending your comments.
|Add these <STYLE>
tags to the <HEAD> section of your
|Put these <DIV> tags in the
<BODY> section of your page.
<DIV class=fly delay=2000>
Copyright © 1997, 1998 Internet Brothers . All Rights Reserved.