hi.
I want to have iframe window positioned at center whenever the page loads in IE, Mozilla and Safari (Windows)
Its working fine in IE and Mozilla. But in safari, first time it shows window at extreme left
and when refreshed the page, it shows it at center.
how to solve this problem?
Please help
-- Here is my code - which positions the iFrame centraly in browser
function PositionDiv(div,iframe) // to Set the Initila position of DIV and iframe
{
w = 475
h= 100
var theDiv = document.getElementById? document.getElementById(div): Document.all? document.all[div]: null;
if(document.all)
{
var height = document.body.clientHeight ;
var width = document.body.clientWidth;
}
else
{
var height =window.innerHeight ;
var width = window.innerWidth;
}
if(theDiv) {
//w = theDiv.offsetWidth
pleft = (width - w) / 2
//theDiv.style.left = pleft +"px"
ptop = (height - h) / 2
theDiv.style.top = ptop +"px"
var theIframe = document.getElementById(iframe)
if (theIframe)
{
//theIframe.style.left = pleft
//theIframe.style.top = ptop
}
//var theTable = documentdocument.getElementById("Table1")
}
//alert(theIframe.style.left)
alert(theDiv.style.left)
}
Thanks
Prasad
Page 1 of 1
Safari causing problem while loading iFrame.......
#3
Posted 02 October 2008 - 09:51 AM
To be honest you shouldn't need any JavaScript at all - there are various CSS methods for forcing an element to display in the centre of a page. Try these links:-
http://www.wpdfd.com...0103.htm#toptip
http://www.jakpsatweb.cz/css/css-vertical-...r-solution.html
http://www.wpdfd.com...0103.htm#toptip
http://www.jakpsatweb.cz/css/css-vertical-...r-solution.html
Share this topic:
Page 1 of 1
Help














