Results 1 to 3 of 3

Thread: IE Warning

  1. #1
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default IE Warning

    1) Script Title: Virtual Pagination script v2.1

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...pagination.htm
    3) Describe problem:
    Hi
    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That probably means that where you have something like this:

    Code:
    <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"])
    
    </script>
    there is no element on the page with an id of gallerypaginate2. If that's the problem, you could just change it to:

    Code:
    gallery.buildpagination(["gallerypaginate"])
    Or you could add an error correcting routine to the script. Find the buildpagination function in the script and replace it with this one:

    Code:
    // -------------------------------------------------------------------
    // 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++){
    		if(document.getElementById(divids[i])){
    			document.getElementById(divids[i]).innerHTML=paginaterawHTML
    			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.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you sooooooooo much.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •