Dynamic HTML

Well, platform considerations are not getting any less complicated for Web developers. With the introduction of Internet Explorer version 4.0, Microsoft added a new twist to client-side functionality: Dynamic HTML, which allows tags to be programmatically changed through scripting. This is incredibly powerful. Consider the code in Listing 1-5, which uses VBScript to detect when the mouse is over some text on the Web page and then changes the text color and size.

Listing 1-5. Dynamic HTML.


<HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Developer Studio"> <META HTTP-EQUIV="Content-Type" content="text/html;      charset=iso-8859-1"> <TITLE>Dynamic HTML</TITLE> <SCRIPT LANGUAGE="VBScript"> <!--     Function MyFont_OnMouseOver()         MyFont.Color = "Red"         MyFont.Size = "5"     End Function     Function MyFont_OnMouseOut()         MyFont.Color = "Blue"         MyFont.Size = "4"     End Function --> </SCRIPT> </HEAD> <BODY BGCOLOR="WHITE"> <FONT ID="MyFont" FACE="ARIAL" SIZE="4" COLOR="BLUE"> Hey, put your mouse here! </BODY> </HTML> 

Dynamic HTML defines a series of events that can be associated with HTML tags. This expands the event-driven paradigm of VBScript to include every element in the page—HTML tags, ActiveX controls, and even the browser itself have events. If you had any lingering doubt that you needed a thorough knowledge of HTML to effectively create Web pages, the preceding example should convince you. In the example, the VBScript code dynamically changes the COLOR and SIZE attributes of the <FONT> tag when mouse activity is detected. You cannot write this code unless you know exactly what the <FONT> tag is and understand its COLOR and SIZE attributes. So long, graphical editors!

Dynamic HTML adds a wealth of power and interactivity to the Web client not only through dynamic style manipulation but through other features as well. Dynamic HTML understands how to position elements on the Web page. You can, for example, translate an image by changing the attributes of a simple <IMG> tag. You can also add or delete tags from the page to create changing content. Finally, Internet Explorer 4.0 also supports the data binding of form fields. This means that a database on the server can be wired directly to a form field on the browser for rapid updates and edits. All of this makes Dynamic HTML a powerful tool worthy of your time. This book dedicates a significant number of pages to understanding and using Dynamic HTML, but remember one thing: Dynamic HTML is currently available only to Internet Explorer 4.0, despite Microsoft's efforts to create it as an open standard.



Programming Active Server Pages
Programming Active Server Pages (Microsoft Programming Series)
ISBN: 1572317000
EAN: 2147483647
Year: 1996
Pages: 84

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net