URGENT..Javascript dynamic drop down menu and pagination !!

I have this javascript code that calls the images in my folders dynamically so I don’t have to hardcode any iamge filenames. I don’t know how to add pagination into this so that only 6-8 images will appear at a time and I can click the page number generated based on how many images I have to move the next 6-8 images. I also need help with creating a javascript DYNAMIC drop down menu. I tried using php to do it but it’s not working. So is there a way I can populated the drop down menu based on the uploaded categories of my images to show the images in that specific category?

<div id="ImageContainer"></div>
<br />
    
<script type="text/javascript"><!--
	
	function ShowGallery()
	{
		// get parent for image container and remove image container
		var parentcontainer = document.getElementById("ImageContainer").parentNode;
		parentcontainer.removeChild(document.getElementById("ImageContainer"));

		// get current image gallery information from dropdown
		var dropdown = document.getElementById("catDropDown");
		var selectedoption = dropdown.getElementsByTagName("option")[dropdown.selectedIndex];
		var count = parseInt(selectedoption.getAttribute("Count"));

		// if there are not images in the category, return - "select a category" falls into this case as well
		if(count<=0)
		    return;

		// populate images in image elements
		var container = document.createElement("div");
		container.setAttribute("id","ImageContainer");
		for(var i=0;i<count;i++)
		{
		    var img=document.createElement("img");
                    img.setAttribute("src","images/th/thumb_"+dropdown.value+(i<9?"0":"")+(i+1)+".jpg");
		    img.setAttribute("alt","images/th/thumb_"+dropdown.value+(i<9?"0":"")+(i+1)+".jpg");
		    container.appendChild(img);

		}

		// Insert new image container back with new contents
		parentcontainer.appendChild(container);
		
	}
/*	
var link=document.createElement("a");
link.setAttribute("href","images/regular/"+dropdown.value+(i<9?"0":"")+(i+1)+".jpg");
link.setAttribute("rel","lightbox");
link.setAttribute("title","This is static description");
var img=document.createElement("img");
              img.setAttribute("src","images/th/thumb_"+dropdown.value+(i<9?"0":"")+(i+1)+".jpg");
img.setAttribute("alt","images/th/thumb_"+dropdown.value+(i<9?"0":"")+(i+1)+".jpg");
link.appendChild(img);
container.appendChild(link);
*/
-->
</script>
Sponsor our Newsletter | Privacy Policy | Terms of Service