Jump to content

Errors using PHP & JavaScript


x-Boy

Recommended Posts

I'm using a gallery (JavaScript/jQuery) that loads the images from an array, and I'm using php to get the images and fill the JS array, it works OK with firefox, safari, chrome, etc. but not with InternetExplorer, it generates and error, the error alert is exposed below.

 

Can somebody tell me how to make it work with IE7?

 

Line:          35

Character:  3

Error:        'imagearray[...].0' is null or not an object

Code:        0

 

<script type="text/javascript">


var mygallery=new simpleGallery({
wrapperid: "simplegallery1", //ID of main gallery container,
dimensions: [532, 675], //width/height of gallery in pixels. Should reflect dimensions of the images exactly [250, 180
imagearray: [

<?php
$imagegallery = $gallery;
foreach(glob("galleries/".$imagegallery."/small/*.jpg") as $smallimage) {
list($width, $height, $type, $attr) = getimagesize($smallimage);
if ($width == 532 && $height == 675){
	$largeimage = str_replace("small", "large", $smallimage);
	echo "[\"./$smallimage\", \"#\", \"openPopup('./$largeimage');\", \"\"],\n";
}else{}
}	
?>

],
autoplay: [true, 5000, 5], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]
persist: false, //remember last viewed slide and recall within same session?
fadeduration: 1000, //transition duration (milliseconds)
oninit:function(){ //event that fires when gallery has initialized/ ready to run
	//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))
},
onslide:function(curslide, i){ //event that fires after each slide is shown
	//Keyword "this": references current gallery instance
	//curslide: returns DOM reference to current slide's DIV (ie: try alert(curslide.innerHTML)
	//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)
}
})
</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.