I am trying to print a header on each printed page, I have tried the code standalone and it works fine, but when thrown in below context it only prints on the first page only sample report showing header on first page only.
what am i doing wrong?
//css style sheet
<style>
@media screen {
.only_print{
display:none;
}
}
@media print {
.no-print {
display: none !important;
}
}
</style>
<cfoutput>
<p id="arr1" ></p>
//below script generates the table wth header tag into <p> arr1
<script type="text/javascript">
function disptbl()
{
var str1=localStorage.getItem('schedule');
var p=localStorage.getItem('payno');
var str='';
var result = str1.split(',');
//create table using thead and tbody
str += ' <table width="92%" align="center">';
str += '<thead>';
str += '<tr class="only_print">';
str += '<td colspan="3" align="center"> <h2><b>Data For #url.txtl#</b></h2></td>';
str += '</tr>';
str += '</thead>';
str += '<tbody>';
for loop to split data into columns
for( var x=0; x < p; x++ ){
str += '<tr>';
str += '<td align="right">'+result[6+x*10]+'</td>';
str += '<td align="right">'+result[0+x*10]+'</td>';
str += '</tr>';
}
//assign create table to <p>
document.getElementById("arr1").innerHTML = str;
}
call function
disptbl();
</script>
</cfoutput>