Div fix problem in IE6 with frame

Discussion in 'JavaScript' started by pankaj.ghadge, Oct 21, 2008.

  1. #1
    Hello
    i am trying create a dynamic div from left frame and i want to display it in a right frame with fix position in IE6.....
    Solution work well with single page.
    I need u r help.............
    please help me out.......

    main.html
    <html>
    <head>
    </head>
    <frameset cols="30%, *" id="fs1">
    <frame src="left.html" name="left" frameborder="1" id=leftId>
    <frame src="right.html" name="right" frameborder="1" id=leftId>
    </frameset>
    </html>


    left.html
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <script type="text/javascript">
    function openDiv(divTop,divLeft)
    {
    var newDiv = parent.right.document.createElement('div'), s = newDiv.style;
    s.border = '1px solid gray';
    s.color = '#ccc';
    s.width = '200px';
    s.height = '200px';
    s.backgroundColor = '#488be8';
    s.top = '200px';
    s.left = '200px';
    s.position = 'fixed';
    if(typeof fixedIE == 'function')
    {
    s.position = 'absolute';
    s.setExpression('top', "fixedIE('Top',"+divTop+")");
    s.setExpression('left', "fixedIE('Left',"+divLeft+")");
    parent.right.document.body.style.background = 'url(foo) fixed';
    };
    parent.right.document.body.appendChild(newDiv);
    };
    </script>
    <!--[if lte IE 6]>
    <script type="text/javascript">
    function fixedIE(tl, n){
    var sc='scroll'+tl, d=parent.right.document, c='compatMode';
    return d[c] && d[c]=='CSS1Compat'? d.documentElement[sc]+n+'px' : d.body[sc]+n+'px';
    }
    </script>
    <![endif]-->

    </head>
    <body>
    <input type="button" value="click me to create Div in Right frame" onclick="return openDiv(100,100);">
    </body>
    </html>

    right.html
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <body>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    <p>Other Content</p>
    </body>
    </html>
     
    pankaj.ghadge, Oct 21, 2008 IP