Defining dynamic properties inside your HTML <div style="width:
expression(document.body.clientWidth/2+'px'); background-color:
yellow"> This DIV will always be half the size of the page's
width </div> Now, in the above example, I used the expression:
to derive half of the page's width. But wait, there's a catch!
You see, in IE, depending on whether a page contains a valid
doctype declaration at the very top of the page, the way to
referencing numerous properties of the body changes as a result.
Namely, if your page does, the syntax "document.documentElement"
needs to be used instead of "document.body": Taking this
unexpected bit of information into account, we can create an
expression that works in all types of pages in IE:
expression(document.compatMode=='CSS1Compat'?
document.documentElement.clientWidth/2+'px' :
body.clientWidth/2+'px'); The above expression tests for the
precense of a valid doctype, and switches between the two
possible syntax to referencing the desired property in IE.
Notice how all the