Web Design Forum: Safari causing problem while loading iFrame....... - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Safari causing problem while loading iFrame....... Rate Topic: -----

#1 User is offline   kulkarnidattaprasad 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 19-June 08
  • Reputation: 0
  • Location:Pune, India
  • Experience:Beginner
  • Area of Expertise:Web Developer

  Posted 19 June 2008 - 09:50 AM

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
0

#2 User is offline   SEO Fan 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 02-October 08
  • Reputation: 0
  • Experience:Beginner
  • Area of Expertise:SEO

Posted 02 October 2008 - 09:43 AM

Do you have users visiting your site with Safari?
0

#3 User is offline   ZigPress 

  • n/a
  • PipPipPipPip
  • Group: Validating
  • Posts: 966
  • Joined: 16-May 08
  • Reputation: 1
  • Gender:Not Telling
  • Experience:Nothing
  • Area of Expertise:Nothing

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
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users