Results 1 to 2 of 2

Thread: javascript not worked in IE.

  1. #1
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up javascript not worked in IE.

    I write javascript for image slide show.

    Code:
    		
    var mygallery=new fadeSlideShow({
    wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
    dimensions: [380, 469], //width/height of gallery in pixels. Should reflect dimensions of largest image
    imagearray: [
    <?php $q2 = mysql_query("select * from home_flash");
    $i = 0;
    while($res = mysql_fetch_array($q2))
    {
    	$image[$i] 	= $res[1];
    	$text[$i] 	= $res[2];
    	$str = "['images/fla/".$image[$i]."','','','".$text[$i]."'],";
    	echo $str;
    	$i++; 
    } ?>
    
    //<--no trailing comma after very last image element!
    ],
    displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
    persist: false, //remember last viewed slide and recall within same session?
    fadeduration: 500, //transition duration (milliseconds)
    descreveal: "always",
    togglerid: ""
    })
    In IE I got an error

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2)
    Timestamp: Sat, 20 Mar 2010 06:22:10 UTC

    Message: 'imagearray[...].0' is null or not an object
    Line: 37
    Char: 3
    Code: 0
    If you have solution for thi, then please help with it!

    Thanks for your precious time.

    Cheers!!

  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

    The problem is that there can be no trailing comma after the last entry in the imagearray. Here's one way to avoid that:

    Code:
    var mygallery = {
    wrapperid: "fadeshow1", //ID of blank DIV on page to house Slideshow
    dimensions: [380, 469], //width/height of gallery in pixels. Should reflect dimensions of largest image
    imagearray: [
    <?php $q2 = mysql_query("select * from home_flash");
    $i = 0;
    while($res = mysql_fetch_array($q2))
    {
    	$image[$i] 	= $res[1];
    	$text[$i] 	= $res[2];
    	$str = "['images/fla/".$image[$i]."','','','".$text[$i]."'],";
    	echo $str;
    	$i++; 
    }
    
    echo "['images/fla/','','','']";
    
    ?>
    
    //<--no trailing comma after very last image element!
    ],
    displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false},
    persist: false, //remember last viewed slide and recall within same session?
    fadeduration: 500, //transition duration (milliseconds)
    descreveal: "always",
    togglerid: ""
    };
    
    mygallery.imagearray.pop();
    
    new fadeSlideShow(mygallery);
    Last edited by jscheuer1; 03-20-2010 at 04:20 PM. Reason: add explanation
    - John
    ________________________

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

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
  •