Notes Ninjas Notes Ninjas
Lotus Notes hints, tips, error messages
Altering Iframe height depending on content

Hint Short Cut: Add this to your code & documentation to help you find this page.
http://www.notesninjas.com/#IframeHeight or http://www.notesninjas.com/A555F9/nn.nsf/ByAlias/IframeHeight


Iframes are quite cool if you want to change the content of a page without altering the borders or navigator. This code changes the size of the iframe each time the content is reloaded to avoid scroll bars.





Hope this makes sense:

Put this in the JSHeader of the document hosting the iframe.

function iFrameHeight(iframeid) {
 // used by iframes to adjust size to content
 if(document.getElementById && !(document.all))
 {
   h = document.getElementById(iframeid).contentDocument.body.scrollHeight;
   document.getElementById(iframeid).style.height = h;
 }
 else if(document.all)
 {
   h = document.frames(iframeid).document.body.scrollHeight;
   document.all[iframeid].style.height=h;
 }
}

 

<iframe onLoad="iFrameHeight();"id="content" name="content" width="610px"  align="left" frameborder="no" scrolling="no" src="t_main.asp">&nbsp;</iframe>

This code may go into a computedtext value:

DBName := @Implode(@Explode(@Subset(@DbName;-1); @Char(92));"/");
url:="/"+DBName+"/DocumentsByUser?openview&count=5&restricttocategory="+@URLEncode("Domino";@Name([CN];@UserName));

"<IFRAME  onLoad=\"iFrameHeight('MyDociframe');\" id='MyDociframe' name='MyDociframe' height=106 width=712  frameborder=0 marginwidth=0 marginheight=0  src='"+url+"'>"+
"Try <a href='"+url+"'>here</a>"+
"</IFRAME>"

 

 Jump to:     Notes Tips
    Lotus Notes Index 
  Register for Tips
Previous Lotus Notes Tip 
    Next Lotus Notes Tip
Your company logo here?
Adam Foster
Free Cash Making Web Site
Free Revenue Earning Blog Site
 Free Revenue Earning Newsletter Site   
Free Search Pages Free Web stats
Free Contact Us page
Cheap .com domain names
 Need a website or 
   Lotus Notes
  problem solved?
Adam Foster
Web Services Platform Architecture: Soap, WSDL, WS-Policy, WS-Addressing, WS-Bpel, WS-Reliable Messaging and More by Francisco Curbera, Frank Leymann, Tony Storey, Donald Ferguson, Sanjiva Weerawarana
Other books claim to present the complete Web services platform architecture, but this is the first one I've seen that really does. The authors have been intimately involved in the creation of the architecture. Who better to write this book?
See at: Amazon.co.uk | Amazon.com |