lp_view.lib.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. //Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
  7. //Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
  8. var iframeid = "lp_content_frame";
  9. //Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
  10. var iframehide = "no";
  11. //var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1];
  12. var FFextraHeight = 32;
  13. //parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ browsers
  14. function resizeIframe(frameid) {
  15. var currentfr=document.getElementById(frameid);
  16. if (currentfr && !window.opera){
  17. currentfr.style.display="block";
  18. if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight){ //ns6 syntax
  19. currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
  20. }
  21. else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
  22. currentfr.height = currentfr.Document.body.scrollHeight;
  23. if(currentfr.height < 580){
  24. currentfr.height = 580;
  25. }
  26. if (currentfr.addEventListener)
  27. currentfr.addEventListener("load", readjustIframe, false);
  28. else if (currentfr.attachEvent){
  29. currentfr.detachEvent("onload", readjustIframe); // Bug fix line
  30. currentfr.attachEvent("onload", readjustIframe);
  31. }
  32. }
  33. }
  34. function resizeCaller() {
  35. if (document.getElementById)
  36. resizeIframe(iframeid);
  37. //reveal iframe for lower end browsers? (see var above):
  38. if ((document.all || document.getElementById) && iframehide=="no"){
  39. var tempobj=document.all? document.all[iframeid] : document.getElementById(iframeid);
  40. tempobj.style.display="block";
  41. }
  42. }
  43. function readjustIframe(loadevt) {
  44. var crossevt=(window.event)? event : loadevt;
  45. var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement;
  46. if (iframeroot)
  47. resizeIframe(iframeroot.id);
  48. }
  49. if (window.addEventListener)
  50. window.addEventListener("load", resizeCaller, false);
  51. else if (window.attachEvent)
  52. window.attachEvent("onload", resizeCaller);
  53. else
  54. window.onload = resizeCaller;