Si può partire da una cosa del genere; testato su Netscape/FireFox e IExplorer 7.
Al momento, devi editare manualmente il numero in cell<9 e in amount > 80 quale altezza (in pixel) assegnata al DIV nello STYLE.
Prova anche cambiando la dimensione testo dal top-menù del Browser e vedi che lo SCRIPT si comporta di conseguenza.
codice:<!DOCTYPE html PUBLIC> <html> <head><title>cells against container measuring</title> <script type="text/javascript"> function detect(){ var amount = 0; var whatones = ""; for(cell=1; cell<9; cell++){ // gli ID delle celle vanno da 1 a 8 amount = amount + document.getElementById(cell).offsetHeight; if(amount > 80){whatones = whatones + cell + " / ";}; }; document.getElementById('display').value = whatones; } </script> </head><body> <input value="quali" type="button" onclick="detect();"> <input value="" type="text" size="40" id="display"> <div style="height: 80px; overflow: hidden; border: 1px dashed red;"> <table id="tb" border="0" cellpadding="0" cellspacin="0"> <tr><td id="1">aaaaa</td></tr> <tr><td id="2">bbbbb</td></tr> <tr><td id="3">ccccc</td></tr> <tr><td id="4">ddddd</td></tr> <tr><td id="5">eeeee</td></tr> <tr><td id="6">fffff</td></tr> <tr><td id="7">ggggg</td></tr> <tr><td id="8">hhhhh</td></tr> </table> </div> </body> </html>

Rispondi quotando