Dynamic HTML

CS4984 - Prof. Abrams

Reference


Motivation


What does "Dynamic" mean?

Static HTML

After Web page loads, it looks the same and never changes.

Dynamic HTML

After loading the Web page can change itself! Dynamic HTML today means
HTML + Style Sheets + Scripting + DOM

DOM = Document Object Model

DOM is a way to refer to any tag within HTML doc to permit modification via scripting

Examples of Dynamic Nature


Technology Progression

  1. Static Web pages, server side image maps
  2. Forms and CGI scripts (server side scripting)
  3. Client side image maps
  4. Java Applets
  5. Plug-ins/Active-X on client, then server side permit non-html (e.g., QuickTime movies, PDF)
  6. Client side scripting:  JavaScript/JScript or VBScript to modify limited Web page features
    1. (e.g., JavaScript can change background, but not color of a paragraph or text in a button)
  7. Dynamic HTML

Common Element to Microsoft and Netscape


Microsoft's Dynamic HTML

Object Model

Binding Page Elements to Database Records

Tables attached to database; automatically update as database changes

Back-end Interface without Web Server Involvement

Other Features of IE 4.0


Netscape's Dynamic HTML

JavaScript accessible style sheets:  JASS

Dynamic font support


Example of Positioning

Use new "position" property.
<body>
<p>Beginning of body contents.
<span id=box> Start of inner content.</span>
End of body contents.
</p>
</body>
Suppose box is defined as
#box {position:absolute; top: 200px; left: 200 px}
HTML above produces something like this (click here to view result):
(0,0)                            (400,0)
+---------doc window---------------+
|Beginning of body contents.  End  |
|of body contents.                 |
|                                  |
|                                  |
|                                  |
|               +-----------------+|
|               |Start of inner   ||
|               |box contents.    ||
|               +-----------------+|
|                                  |
|                                  |
+---------doc window---------------+
(0,400)                           (400,400)

Notes:



Example of Document Object Model

Consider the following Web page...

The HTML tags form a document tree like this:

So you can refer hierarchically to an element in the HTML document like this:

document.images.button1
And you can refer to an attribute of an element like this:
document.images.button1.src
You can change the value of an attribute in response to various event handlers: So you can change the appearance of a button when the mouse moves over it as follows: Look here for the result, generated by this document:
<html>
<title>Example of document object model</title>
<body>
<p>Move the mouse over the image below, and you will see a second image appear!
</p>
<a href="next.html" onMouseOver="document.images.button1.src='click.gif'">
<img src="click2.gif" NAME="button1">
</body>
</html>

Example of CSS

This is given in a separate document.


Last modified on 30 October 2000  by abrams@vt.edu.