Hi, so I've got this problem which I just can't seem to solve, even after looking at many resources and this archive. Have a look-see, please. I'm currently not using jquery for this function, but I imagine I could be.
What I'm trying to do is call on a record from a database which will have, among other things, 1-4 pictures associated with it. Ideally, I want one statement to request all images in the record, and then one statement to loop through the results and display however many images are found. Each picture file is called picture1, picture2, picture3 and picture4. An important point is that if there is anything less than four pictures in the record, that the code should just grab whatever's there and then move on. Below is a copy of the script I'm currently using, which works as intended in IE6, but FF gets hung up when it finds there's anything less than four pictures. (I know the following script calls each picture separately, but I don't know how to make the loop.) <script language="javascript" type="text/javascript"> image2 = "picture2" image3 = "picture3" image4 = "picture4" imgNo=0 function newimage2() { imgNo+=1 document.getElementById("image2").innerHTML='<img src="'+image2[imgNo] +'" onError="newimage2()">' if (imgNo>image2.length) {document.getElementById ("image2").innerHTML='';return} } function newimage3() { imgNo+=1 document.getElementById("image3").innerHTML='<img src="'+image3[imgNo] +'" onError="newimage3()">' if (imgNo>image3.length) {document.getElementById ("image3").innerHTML='';return} } function newimage4() { imgNo+=1 document.getElementById("image4").innerHTML='<img src="'+image4[imgNo] +'" onError="newimage4()">' if (imgNo>image4.length) {document.getElementById ("image4").innerHTML='';return} } </script> ...and inside the <body>: <span id="image2"> <A HREF="%%picture2%%" rel="lytebox"><img src="%%picture2%%" onError="newimage2()" width="120" border="1" align="center"> </span> <span id="image3"> <A HREF="%%picture3%%" rel="lytebox"><img src="%%picture3%%" onError="newimage3()" width="120" border="1" align="center"> </span> <span id="image4"> <A HREF="%%picture4%%" rel="lytebox"><img src="%%picture4%%" onError="newimage4()" width="120" border="1" align="center"> </span>