Thomas J.: Variable DIV-Breite im Netscape 4.x mit Javascript

Beitrag lesen

Ich nochmal

Auf diesen Seiten hatte ich schon geschaut, aber sie gehen im NS4 nicht :-( Es steht nur ein netter Text da: "This site will look much better in a browser tht supports current web standards, ..."

Siehe Antwort von uepselon

if ( ns4 )document.layers["text"].width = window.innerWidth - 455;
müßte eigentlich funktionieren.

Funktioniert leider nicht. NS4 kann auch nur den Befehl innerWidth interpretieren

Dann versuche doch einfach mal window.innerWidth zunächst in eine Variable zu speichern.
winw = window.innerWidth und dann
document.layers["text"].width = winw - 455;

<style type="text/javascript">
ids.text.width = window.innerWidth - 455;
</style>
Geht leider auch nicht. Warum weiß ich nicht.

Ich hab's eben getestet. Es geht.

<style type="text/css">
<!--
#text {
 position:absolute;
 .
 .
 .
 usw.
}
-->

<style type="text/javascript">
ids.text.width = window.innerWidth - 455;
ids.text.left =  "455";
</style>

Und dann im body <div id="text"> ... </div> ergibt einen Layer, der links bei 455px beginnt und sich bis (fast) zum rechten Fensterrand erstreckt.

Thomas J.