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
https://forums.phpfreaks.com/topic/155722-errors-using-php-javascript/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.