<body>
<span id="trueBlueSpan"
style="background-color:lightblue; width:100px">
The width of this blue span is set inline at 100 pixels.
</span>
<span id="oldYellowSpan" style="background-color:lightyellow;
width:200px">
The width of this yelllow span is set inline at 200 pixels.
</span>
<br>
<span id="AlGreenSpan" style="background-color:lightgreen;
width:expression(trueBlueSpan.style.pixelWidth +
oldYellowSpan.style.pixelWidth)">
Click the button below to see the expression used to set
the width of this span.
</span>
<br>
<button onclick=alert(AlGreenSpan.style.getExpression("width"));>
See Expression</button>
</body>
<html>
<head>
<script language="JScript">
var s;
function fnInit() {
Box3.style.setExpression("width","eval(Box1.value) + eval(Box2.value)",
"jscript");
}
function getexp() {
s=Box3.style.getExpression("width");
alert("Expression for the width of the blue box is \n\n" + s +
"\n\nThe width property has a value of " + Box3.style.width);
}
</script>
</head>
<body onload=fnInit();>
<input type=text id="Box1" value=40>
<br><input type=text id="Box2" value=40>
<br><input type=text id="Box3" style="background-color:blue">
<br><input type=button id="Button2" value="Get expression" onclick="getexp()">
</body>
</html>