I’m trying to build a page that displays the table’s row and cell’s width and height. Below is the snippet:
<script type="text/javascript">
var printDimension = {
printIt : function(){
subject = document.getElementById('subject');
subjectrow = document.getElementById('subjectrow');
subjectcell = document.getElementById('subjectcell');
subjectrowHeight = subjectrow.offsetHeight;
subjectrowWidth = subjectrow.offsetWidth;
subjectcellHeight = subjectcell.offsetHeight;
subjectcellWidth = subjectcell.offsetWidth;
$('#tablerowheight').html(subjectrowHeight);
$('#tablerowwidth').html(subjectrowWidth);
$('#tablecellheight').html(subjectcellHeight);
$('#tablecellwidth').html(subjectcellWidth);
}
}
</script>
<table id="subject">
<tr id="subjectrow">
<td id="subjectcell"><div class="image-wrapper"><img src="6tox52w5.png" /></div></td>
</tr>
</table>
Now, it prints fine in FF. The value is off in chrome. And finally, nothing gets displayed in IE.
I notice that window.onload produces an error:
Error: window.onload is not a function
Source File: /tableTest.html
Line: 78
It may be the problem, although the script still runs though. How do I get it to work properly?