By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

How can I make an IFRAME resize itself when someone changes their resolution?

P: 36
How can I make an IFRAME resize itself when someone changes their resolution?

I have a table in that i am loading that iframe, I did give the width of Iframe and the width of table as 100%, What shall i need to solve the problem...

ANy help would be appreciated..
By @sharf
Jan 9 '08 #1
Share this Question
Share on Google+
2 Replies


kunal pawar
100+
P: 297
give width of Iframe in % then it will work properly
Jan 10 '08 #2

P: 36
I did that in percentage but its not working properly,
Any way I got the solution, Its is by using a java script, Just as follows,

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function getPosition()
  3. {
  4.  var theElement = document.getElementById("ifrept");
  5.  
  6. var widthX = screen.width
  7. var heightY = screen.height
  8. var positionX = 0;
  9. var positionY = 0;
  10.  
  11.  while (theElement != null)
  12.  {
  13.    positionX += theElement.offsetLeft;
  14.    positionY += theElement.offsetTop;
  15.    theElement = theElement.offsetParent;
  16.  }
  17.    var theElement = document.getElementById("ifrept"); 
  18.    theElement.height=(heightY-positionY)-225;
  19.    theElement.width=(widthX-positionX)-98;
  20.  
  21.  
  22. </script>
  23.  
Jan 10 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.