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

iFrame's width height is not set dynamically..

dmjpro
100+
P: 2,476
Expand|Select|Wrap|Line Numbers
  1. var iFrame = document.createElement('IFRAME');
  2.         iFrame.name = 'frame';
  3.         iFrame.id = 'frame';
  4.         iFrame.addEventListener("load",function(){
  5.             var w = getDocWidth('frame');
  6.             var h = getDocHeight('frame');
  7.             alert(w+'\t'+h);
  8.             iFrame.width = w + 'px';
  9.             iFrame.height = h + 'px';
  10.         },true);
  11.         document.body.appendChild(iFrame);
  12.         frames['frame'].location.href = 'span_test.html';
  13.  
is this a right way to set the width height of an iFrame dynamically?
Feb 10 '10 #1
Share this Question
Share on Google+
1 Reply


P: 86
should be iFrame.style.width, same for height
Feb 11 '10 #2

Post your reply

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