This is the form where you'll see the schedules of a specific subject with details:
This is what happen when I click the print button:
This is the button to print.
<button onclick="print('to-print')">Print</button>
This is what will be print.
<div id="to-print">
<table>
<thead>
<th>Teacher In-charge</th>
<th>Time</th>
<th>Section</th>
<th>Room</th>
</thead>
<tbody>
<tr>
<td>John Doe</<td>
<td>M-W-F / 7:00 - 8:00 am</td>
<td>A</td>
<td>Room 1</td>
</tr>
</tbody>
</table>
</div>
The javascript functions.
<script>
function printdiv(printpage) {
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
}
</script>
I already used this kind of method in my css but then it will also remove the Title
<style>
@page { size: auto; margin: 0mm; }
</style>