lp_view.lib.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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; //parseFloat(getFFVersion)>=0.1? 16 : 0; //extra height in px to add to iframe in FireFox 1.0+ browsers
  13. function resizeCaller() {
  14. if (document.getElementById)
  15. resizeIframe(iframeid);
  16. //reveal iframe for lower end browsers? (see var above):
  17. if ((document.all || document.getElementById) && iframehide=="no"){
  18. var tempobj=document.all? document.all[iframeid] : document.getElementById(iframeid);
  19. tempobj.style.display="block";
  20. }
  21. }
  22. function resizeIframe(frameid){
  23. var currentfr=document.getElementById(frameid);
  24. if (currentfr && !window.opera){
  25. currentfr.style.display="block";
  26. if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight){ //ns6 syntax
  27. currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
  28. }
  29. else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
  30. currentfr.height = currentfr.Document.body.scrollHeight;
  31. if(currentfr.height < 580){
  32. currentfr.height = 580;
  33. }
  34. if (currentfr.addEventListener)
  35. currentfr.addEventListener("load", readjustIframe, false);
  36. else if (currentfr.attachEvent){
  37. currentfr.detachEvent("onload", readjustIframe); // Bug fix line
  38. currentfr.attachEvent("onload", readjustIframe);
  39. }
  40. }
  41. }
  42. function readjustIframe(loadevt) {
  43. var crossevt=(window.event)? event : loadevt;
  44. var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement;
  45. if (iframeroot)
  46. resizeIframe(iframeroot.id);
  47. }
  48. if (window.addEventListener)
  49. window.addEventListener("load", resizeCaller, false);
  50. else if (window.attachEvent)
  51. window.attachEvent("onload", resizeCaller);
  52. else
  53. window.onload=resizeCaller;