Advertisement
Kimeraweb

iFrame autojaustable

Jan 25th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script type="text/javascript">
  2.  
  3. function getDocHeight(doc) {
  4.     doc = doc || document;
  5.     // from http://stackoverflow.com/questions/1145850/get-height-of-entire-document-with-javascript
  6.     var body = doc.body, html = doc.documentElement;
  7.     var height = Math.max( body.scrollHeight, body.offsetHeight,
  8.         html.clientHeight, html.scrollHeight, html.offsetHeight );
  9.     return height;
  10. }
  11.  
  12. function setIframeHeight(id) {
  13.     var ifrm = document.getElementById(id);
  14.     var doc = ifrm.contentDocument? ifrm.contentDocument: ifrm.contentWindow.document;
  15.     ifrm.style.visibility = 'hidden';
  16.     ifrm.style.height = "10px"; // reset to minimal height in case going from longer to shorter doc
  17.     ifrm.style.height = getDocHeight( doc ) + "px";
  18.     ifrm.style.visibility = 'visible';
  19. }
  20. </script>
  21.  
  22. <!--------------------------------------------------------------------------- LADO DERECHO -------------------------------------------------------------->
  23. <div name="LADODERECHO" style="float:left; width:74%; height:auto;">  
  24.   <div name="webDiv">
  25. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  26.   <tr>
  27.     <td height="50" width="50" style="background:url(graficos/esquina1-1.png); background-repeat:no-repeat;"></td>
  28.     <td height="50" style="background:url(graficos/patron_superior.png); background-repeat:repeat-x;">
  29.     <td height="50" width="50" style="background:url(graficos/esquina2-1.png); background-repeat:no-repeat;">
  30.   </tr>
  31.   <tr>
  32.     <td width="50" style="background:url(graficos/patron_bode_izquierdo.png); background-repeat:repeat-y;">&nbsp;</td>
  33.     <td style="background:url(graficos/fondo_menu_opciones2.png); background-repeat:repeat;">
  34.    <iframe width=100% height="1000px" id="ifrm" name="ifrm" src="height1.html" onload="setIframeHeight(this.id)">Sorry, your browser doesn't support iframes.</iframe>
  35.  
  36.       </td>
  37.     <td width="50" style="background:url(graficos/patron_bode_derecho.png); background-repeat:repeat-y;"></td>
  38.   </tr>
  39.   <tr>
  40.     <td height="50" width="50" style="background:url(graficos/esquina1-2.png); background-repeat:no-repeat;"></td>
  41.     <td style="background:url(graficos/patron_inferior.png); background-repeat:repeat-x;"></td>
  42.     <td height="50" width="50" style="background:url(graficos/esquina2-2.png); background-repeat:no-repeat;"></td>
  43.   </tr>
  44. </table>
  45.  
  46. </div>
  47. </div> <!--LADO DERECHO -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement