html dynamic value code example

Example: html attribute dynamic value

<div style="width: expression(document.body.clientWidth/2+'px'); background-color: yellow">

  <img src="myimage.gif" style="width: 120px; height: 150px; position:absolute; left: expression(document.compatMode=='CSS1Compat'? (document.documentElement.clientWidth-120)/2+'px' : (body.clientWidth-120)/2+'px'); top:
expression(document.compatMode=='CSS1Compat'? (document.documentElement.clientHeight-150)/2+'px' : (body.clientHeight-150)/2+'px');" />

Tags:

Html Example