I need to fill the array in JavaScript at runtime. Here is an example of the array hard coded or(static) I need dynamic way to fill in the array pending on what images are in the gallery selected:
I'm querying a db to get the slideshow images paths and placeing them into a form:
Then, call in the JavaScript for slideshow and declaring global variable and I need to get the "$info_string" into the JavaScript array. This is what's NOT working.
Any help would be greatly appreciated!
Code:
<script>
Book_Image_Sources=new Array(
"gallery/DSC00002.png","",
"gallery/DSC00003.png","",
"gallery/DSC00004.png","",
"gallery/DSC00005.png","",
"gallery/DSC00006.png","",
"gallery/DSC00007.png","",
"gallery/DSC00008.png","",
"gallery/DSC00009.png","",
"gallery/DSC00010.png",""
);
</script>
I'm querying a db to get the slideshow images paths and placeing them into a form:
Code:
<form name="slideShow">
<input type="hidden" name="info" value="<?php echo $info_string; ?>" >
</form>
Then, call in the JavaScript for slideshow and declaring global variable and I need to get the "$info_string" into the JavaScript array. This is what's NOT working.
Code:
<script>
var str = new String;
str = document.slideShow.info.value;
// to remove any trailing commas
str = str.substring(0, (str.length-1) );
Book_Image_Sources=new Array(str);
</script>
Any help would be greatly appreciated!