Modify height function

2

I have a SQL query that sometimes results in 1000 lines or 10 (to modify the height I used a function with the scrollbar), then I created a filter but ... when applying it the height stays enormous. I would like know how I could reduce it when applying the filter .. Any ideas?

I leave the function that I use to make it bigger, the table (result of the SQL), I have it in an iFrame.

function calcHeight(iframeElement){
    var the_height=  iframeElement.contentWindow.document.body.scrollHeight;
    iframeElement.height=  the_height;

}
<div class="filt">
    <div class="titl">
        <p>Direcciones</p>
    </div>
    <div class="contfiltros">
        <div class="tableDirec">
            <form action="CustomerMasterAddressResult.jsp"  method="post"  target="ifrdirecciones">
            <table>  
                <tr>
                    <td width="10px">Ciudad:</td>
                    <td width="10px" ><input type='text' id='tbciudad' name='tbciudad' value='' size='8'></td>
                    <td width="10px">CP:</td>
                    <td  width="10px"><input type='text' id='tbcp' name='tbcp' value='' size='8'></td>
                    <td width="10px">Provincia:</td>
                    <td width="10px"><input type='text' id='tbprovincia' name='tbprovincia' value='' size='8'></td>
                    <td width="10px">Comercial:</td>
                    <td width="10px"><input type='text' id='tbcomercial' name='tbcomercial' value='' size='8'></td>
                    <td width="10px"></a><button type="submit" value="Submit" onclick="">Buscar</button></td>
                </tr>
            </table>  
            </form>
        </div>
    </div> 
   <br>
</div>
                <div class="iframeCont">
                    <center>
                         <table width="100%" > 
                             <tr>
                                 <td>
                                 <iframe src="CustomerMasterAddressResult.jsp" id="ifrdirecciones" name="ifrdirecciones" frameborder="0" scrolling="no" width="100%" onLoad="calcHeight(this);" ></iframe>
                                 </td>
                             </tr>
                         </table>
                     </center>
                </div>
   <%  }

        }

        sql.CloseConnection();
%>



<jsp:include page="/core/ResyntPageClose.jsp"   flush="true"></jsp:include>

Ahroa I'm playing and it's a little ugly, but I have the problem in the div iFrameCont, in the other jsp, I wrote the function that I leave here, and it returns the correct height after applying each filter the problem ( I lost it by an alert I had put), the problem is that I do not change the height of iFrameCont ... and I do not know what to do.

 <script type="text/javascript">
           var alto = document.getElementById('table').offsetHeight;
           document.getElementById('iframeCont'); obj.style.height = alto+"px";

</script>

    
asked by Iron Man 06.03.2018 в 09:37
source

0 answers