Hey All,
I have a table comprised of 13 six row "sections" distinguished by classNames "headerRow" or alternately "headerRow gray".
Each row contains a <textarea> which if Empty (or value="Note:") will hide (row.display='none') EXCEPT FOR the section headerRow.
This all works fine, however for print formatting I would like to insert a "page-break-before" each section IF and when it grows to a height which exceeds the lower page boundary.
To wit, it would be entirely possible for a user to write "War and Peace" within but a single row/textarea of a given "section", but for the intended use case, and user profile I am not too concerned about that.
Initially, I thought I would simply check position of the headerRow and insert a "page-break-before" if(headerRow.offsetTop > PagePrintHeight) but this would NOT account for the possiblity of the bottom row of the preceeding section also being greater than the specified PagePrintHeight.
Was thinking it might be possible to wrap table sections by <span>section rows</span> gauging by span height, but this doesn't seem to work either. Would be greatful for any suggestions.
Here's a TWO ROW sample "section":
PHP Code:
<script>
function spanHeight(){
var spanHt=document.getElementById('span_1').offsetHeight;
alert(spanHt);
}
</script>
<table id="table1" border="4" cellpadding="0" style="border-collapse: collapse; position:absolute; left:3px; top:43px" bordercolor="#000080" width="689">
<span id="span_1" oncontextmenu="spanHeight(); return false;">
<tr class="headerRow gray" id="grounds1">
<td width="5" valign="top"> </td>
<td width="50" valign="top" align="center"><br>
<b><font color="#FF0000">1</font></b></td>
<td width="585"><b>Page 4 GROUNDS</b><br>
<textarea name="row_1"cols="100" rows="5" onclick="select()" >Note:</textarea></td>
<td align="center" valign="top"><br>
<input type="button" class="button" value="+" name="GD_1" onclick="if(document.Q_note.row_1.value !=='Note:')
{show('grounds2', true); document.Q_note.row_2.select();} else{document.Q_note.row_1.select(); return;}"></td>
</tr>
<tr id="grounds2" class="gray"> <td width="5" valign="top"> </td>
<td width="50" valign="top" align="center">
<b><font color="#FF0000">2</font></b></td>
<td width="585"><textarea name="row_2" cols="100" rows="5" onclick="select()" >Note:</textarea></td>
<td align="center" valign="top">
<input type="button" class="button" value="+" name="GD_2" onclick="if(document.Q_note.row_2.value !=='Note:')
{show('grounds3', true ); document.Q_note.row_3.select();} else { myAlert();show('grounds2',false);}"></td>
</tr>
</span>
</table>