#1
  1. NINJA! ...on fire no less
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Rockies
    Posts
    187
    Rep Power
    15

    Netscape 7 & Dynamic DIV bug


    I have a need to draw a DIV dynamically on the screen via document.createElement("DIV") and return it's width. In Netscape 7, I'm getting some strange behavior (AMAZINGLY...shock).

    Run this script in NS7 to see what I mean...
    Code:
    <html>
    <head>
    <title>Netscape Sux</title>
    <script language="JavaScript" type="text/JavaScript">
    function CreateDIV(WindowSize){
    
    	if (WindowSize==1){window.resizeTo(525,400)}
    	else if (WindowSize==2){window.resizeTo(700,400)}
    
    	var oHL = document.createElement("DIV")
    	oHL.style.position = "absolute"
    	oHL.style.top = "100px"
    	oHL.style.left = "490px"
    	oHL.style.height = "20px"
    	oHL.style.backgroundColor = "red"
    	oHL.innerHTML = "&nbsp;&nbsp;Dynamagical layer&nbsp;&nbsp;"
    	oHL.style.color = "white"
    	document.body.appendChild(oHL)
    	
    	alert("The new DIV has an offsetWidth of " + oHL.offsetWidth)
    }
    </script>
    </head>
    
    <body>
    
    <a href="javascript:CreateDIV(1)">Create DIV on the edge of the viewable window.</a>
    <br>
    <a href="javascript:CreateDIV(2)">Create DIV in the viewable window.</a>
    
    </body>
    </html>
    Can you confirm this weirdo behavior? Know how to return the REAL width every time in NS7?
    Last edited by FragMaster B; October 29th, 2003 at 05:21 PM.
  2. #2
  3. NINJA! ...on fire no less
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Rockies
    Posts
    187
    Rep Power
    15
    Bump.

    Anyone?

IMN logo majestic logo threadwatch logo seochat tools logo