I am implementing pagination on a project currently in progress but I am getting an error with this piece of code in IE8:
var rows = document.getElementById(tableName).rows;
Here is the error:
Message: Object required
I am using this open source code for the pagination:
http://en.newinstance.it/2006/09/27/client-side-html-table-pagination-with-javascript/
Now my question would be, is this a valid piece of code for ie 8? if not what could I substitute to obtain the same results of the given piece of code? (or how can i fix this error :P)
If more information is needed, I’ll try my best to provide.
It looks like
document.getElementById(tableName)is not finding the table which you’re expecting, and so it returnsnull.null.rowsis not valid, and so there’s an error there.I’d recommend splitting that line into two and checking that the element is found before continuing: