You are here: irt.org | FAQ | DHTML | Q1035 [ previous next ]
The following should work on Netscape Navigator 4+ and Internet Explorer 4+:
<body onLoad="textWidth()"> <script language="JavaScript"><!-- function textWidth() { if (document.layers) alert('width = ' + document.layers['nn'].document.width); else if (document.all) alert('width = ' + document.all['msie'].clientWidth); } //--></script> <div id="msie"> <layer id="nn"> How long is this string? </layer> </div>