View Full Version : IE Warning

09-30-2011, 01:34 PM
1) Script Title: Virtual Pagination script v2.1

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm
3) Describe problem:
Im using virtualpaginate.js , im geeting a script error (get elementbyID) in internet explorer 7, 8 in this file (el nombre del archivo js.). Scripts works right, but I need to erase this warning error.
Please any advise on this error would be appreciated.
Thanks in advance

"Internet Explorer Script Error"

An error has occurred in the script on this page.

Line: 85
Char: 3
Error: 'document.getElementeById(...)' is nul or not an object
Code: 0
URL: http://xxx.xxxxx.xxx/virtualpaginate.js

09-30-2011, 04:07 PM
That probably means that where you have something like this:

<script type="text/javascript">

var gallery=new virtualpaginate({
piececlass: "virtualpage", //class of container for each piece of content
piececontainer: 'div', //container element type (ie: "div", "p" etc)
pieces_per_page: 1, //Pieces of content to show per page (1=1 piece, 2=2 pieces etc)
defaultpage: 0, //Default page selected (0=1st page, 1=2nd page etc). Persistence if enabled overrides this setting.
wraparound: false,
persist: false //Remember last viewed page and recall it when user returns within a browser session?

gallery.buildpagination(["gallerypaginate", "gallerypaginate2"])


there is no element on the page with an id of gallerypaginate2. If that's the problem, you could just change it to:


Or you could add an error correcting routine to the script. Find the buildpagination function in the script and replace it with this one:

// -------------------------------------------------------------------
// PUBLIC: buildpagination()- Create pagination interface by calling one or more of the paginate_build_() functions
// -------------------------------------------------------------------

virtualpaginate.prototype.buildpagination=function(divids, optnavtext){
var divids=(typeof divids=="string")? [divids] : divids //force divids to be an array of ids
var primarypaginatediv=divids.shift() //get first id within divids[]
var paginaterawHTML=document.getElementById(primarypaginatediv).innerHTML
this.paginate_build(primarypaginatediv, 0, optnavtext)
for (var i=0; i<divids.length; i++){
this.paginate_build(divids[i], i+1, optnavtext)

BTW, this is probably an error in all browsers, but in IE - until IE 9, virtually all errors are reported by default. With IE 9 and virtually all other browser, errors can only be seen in an error console, which by default is not on.

Since this apparently is a non-fatal error, the script still works.

09-30-2011, 08:07 PM
Thank you sooooooooo much.