PDA

View Full Version : Div fix problem again in IE6 with frame (hey John please help me)



pankaj.ghadge
10-21-2008, 06:44 AM
Hello
I thought it is easy to create div fix in IE6 after getting the solution Dynamic Forum for single page.
but i was wrong ......For single page it is working very well but with frame it is not....
i am trying create a div from left frame and i want to display it in a right frame with fix position in IE6.....
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>