ie6 disappearing float fix
authorGabriel Wicke <gwicke@users.mediawiki.org>
Mon, 19 Apr 2004 16:12:12 +0000 (16:12 +0000)
committerGabriel Wicke <gwicke@users.mediawiki.org>
Mon, 19 Apr 2004 16:12:12 +0000 (16:12 +0000)
stylesheets/IEFixes.js

index a9a7428..0888561 100644 (file)
@@ -6,6 +6,7 @@ else var version = 0;
 window.attachEvent("onload", hookit);
 function hookit() {
     fixalpha();
+    if(version == 6) relativeforfloats();
     fixtextarea();
     var wrapper = document.getElementById('tawrapper');
     if(wrapper) wrapper.attachEvent("onclick", fixtextarea);
@@ -50,3 +51,21 @@ function fixtextarea() {
             wrapper.style.width = (wrapper.offsetWidth - 4)  + 'px';
     }
 }
+
+// fix ie6 disappering float bug
+function relativeforfloats() {
+    var bc = document.getElementById('bodyContent');
+    if (bc) {
+        var tables = bc.getElementsByTagName('table');
+        var divs = bc.getElementsByTagName('div');
+    }
+    setrelative(tables);
+    setrelative(divs);
+}
+function setrelative (nodes) {
+    var i = 0;
+    while (i < nodes.length) {
+        if(nodes[i].style.float || nodes[i].align != '') nodes[i].style.position = 'relative';
+        i++;
+    }
+}