1. /***********************************************
  2. * IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
  3. * Visit DynamicDrive.com for hundreds of original DHTML scripts
  4. * This notice must stay intact for legal use
  5. ***********************************************/
  6.  
  7. //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
  8. //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
  9. var iframeids=["status", "login", "navigation", "content"]
  10.  
  11. //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
  12. var iframehide="yes"
  13.  
  14. var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
  15. var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers
  16.  
  17. function resizeCaller() {
  18. var dyniframe=new Array()
  19. for (i=0; i<iframeids.length; i++){
  20. if (document.getElementById)
  21. resizeIframe(iframeids[i])
  22. //reveal iframe for lower end browsers? (see var above):
  23. if ((document.all || document.getElementById) && iframehide=="no"){
  24. var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
  25. tempobj.style.display="block"
  26. }
  27. }
  28. }
  29.  
  30. function resizeIframe(frameid){
  31. var currentfr=document.getElementById(frameid)
  32. if (currentfr && !window.opera){
  33. currentfr.style.display="block"
  34. if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
  35. currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
  36. else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
  37. currentfr.height = currentfr.Document.body.scrollHeight;
  38. if (currentfr.addEventListener)
  39. currentfr.addEventListener("load", readjustIframe, false)
  40. else if (currentfr.attachEvent){
  41. currentfr.detachEvent("onload", readjustIframe) // Bug fix line
  42. currentfr.attachEvent("onload", readjustIframe)
  43. }
  44. }
  45. }
  46.  
  47. function readjustIframe(loadevt) {
  48. var crossevt=(window.event)? event : loadevt
  49. var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
  50. if (iframeroot)
  51. resizeIframe(iframeroot.id);
  52. }
  53.  
  54. function loadintoIframe(iframeid, url){
  55. if (document.getElementById)
  56. document.getElementById(iframeid).src=url
  57. }
  58.  
  59. if (window.addEventListener)
  60. window.addEventListener("load", resizeCaller, false)
  61. else if (window.attachEvent)
  62. window.attachEvent("onload", resizeCaller)
  63. else
  64. window.onload=resizeCaller