32 This value could be something as simple as a mathematical calculation, or
something as complicated as an expression to calculate an appropriate width based
on the size of the browser window.
Active Scripting Must Be Enabled
In order for expressions to work they do need JavaScript to be enabled on the client
browser. Even though they are called from within a CSS style sheet they??™ll fail if
JavaScript is disabled.
Without getting into too much detail about scripting, here are a couple of examples
to give you an idea of how CSS expressions work.
The first example demonstrates how we can use an expression to imitate the
min-width and max-width CSS properties that aren??™t supported by Internet Explorer
6 and earlier versions. The following example applies to Internet Explorer Windows
versions 5 and above:
#outer{
width: expression(
(d = document.compatMode == "CSS1Compat" ?
document.documentElement : document.body) &&
(d.clientWidth > 1024 ? "1024px" :
d.clientWidth < 600 ? "600px" : "auto")
);
background: red;
}
30 http://msdn2.
Pages:
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561