Jump to content

image gallery help... need 'previous' and 'next' commands


Rogue3

Recommended Posts

I use a simple image gallery for new images on our news site. I'd like to add a 'previous' and 'next' link at the top that automatically goes to the next image in the list (or previous image) to make it easy for viewers to pan through new images. Currently, they have to keep going back to view the next image. Here is our image gallery:

 

http://www.jeditemplearchives.com/news/images2007b/images.php?image=27

 

Here is the code for our php file:

 

<HTML>

<LINK REL=STYLESHEET HREF="/sitetext.css" TYPE="text/css">
<HEAD>

	<TITLE>Jedi Temple Archives Image Gallery</TITLE>

<style type="text/css">
<!--
body {
background-image: url(/images/fill-blue.gif);
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</HEAD>

<BODY leftmargin="0" topmargin="0" rightmargin="0" onLoad="MM_preloadImages('../../images/goback_on.gif')"  >

<span class="class6">

<table width="100%" height="7"  border="0" cellpadding="0" cellspacing="0" background="/images/banner-background-top.gif">
<tr>
<td height="12"><img src="/images/blank.gif" width="5" height="12"></td>
</tr>
</table>


<TABLE width="100%"  border="0" cellpadding="5" cellspacing="0" background="/images/banner-background-mid.gif" >
<TR>
<TD height="85"><div align="center"><a href="/"><img src="/images/banner-logo.gif" width="408" height="65" border="0"></a></div></TD>
</TR>
</TABLE>



<table width="100%" height="7"  border="0" cellpadding="0" cellspacing="0" background="/images/banner-background-bot.gif">
<tr>
<td height="7"><img src="/images/blank.gif" width="5" height="5"></td>
</tr>
</table>
<CENTER>
<img src="../../images/spacer.gif" width="1" height="10"><br>
<TABLE border="0" cellpadding="0" cellspacing="0" width="200">
<TR >
<TD height="27" align="center"><div align="center"></div>
<div align="center"><a href="#" onClick="history.back();" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','/images/goback_on.gif',1)"><img src="/images/goback_off.gif" name="Image6" width="68" height="27" border="0"></a></div></TD>
</TR>
</TABLE>
<img src="/images/spacer.gif" width="1" height="10">

</CENTER>
<table  border="2" align="center" bordercolor="#003333">
<tr>
<TD align="center" >
<font size=3 face="arial" color="#CCCCCC">

<?php

if ($image == "01") {
print ("<img src='/news/images2007b/koto-20070718-01.jpg'>");
} elseif ($image == "02") {
print ("<img src='/news/images2007b/koto-20070718-02.jpg'>");
} elseif ($image == "03") {
print ("<img src='/news/images2007b/koto-20070718-03.jpg'>");
} elseif ($image == "04") {
print ("<img src='/news/images2007b/koto-20070718-04.jpg'>");
} elseif ($image == "05") {
print ("<img src='/news/images2007b/koto-20070718-05.jpg'>");
} elseif ($image == "06") {
print ("<img src='/news/images2007b/koto-20070718-06.jpg'>");
} elseif ($image == "07") {
print ("<img src='/news/images2007b/koto-20070718-07.jpg'>");
} elseif ($image == "08") {
print ("<img src='/news/images2007b/koto-20070718-08.jpg'>");
} elseif ($image == "09") {
print ("<img src='/news/images2007b/koto-20070718-09.jpg'>");
} elseif ($image == "10") {
print ("<img src='/news/images2007b/koto-20070718-10.jpg'>");
} elseif ($image == "11") {
print ("<img src='/news/images2007b/koto-20070718-11.jpg'>");
} elseif ($image == "12") {
print ("<img src='/news/images2007b/koto-20070718-12.jpg'>");
} elseif ($image == "13") {
print ("<img src='/news/images2007b/koto-20070718-13.jpg'>");
} elseif ($image == "14") {
print ("<img src='/news/images2007b/koto-20070718-14.jpg'>");
} elseif ($image == "15") {
print ("<img src='/news/images2007b/koto-20070718-15.jpg'>");
} elseif ($image == "16") {
print ("<img src='/news/images2007b/koto-20070718-16.jpg'>");

} elseif ($image == "17") {
print ("<img src='/news/images2007b/hasbro-20070719a.jpg'>");
} elseif ($image == "18") {
print ("<img src='/news/images2007b/hasbro-20070719b.jpg'>");
} elseif ($image == "19") {
print ("<img src='/news/images2007b/hasbro-20070719c.jpg'>");

} elseif ($image == "20") {
print ("<img src='/news/images2007b/koto-70070723a.jpg'>");
} elseif ($image == "21") {
print ("<img src='/news/images2007b/koto-70070723b.jpg'>");
} elseif ($image == "22") {
print ("<img src='/news/images2007b/koto-70070723c.jpg'>");

} elseif ($image == "23") {
print ("<img src='/news/images2007b/sdcc-lego.jpg'>");

} elseif ($image == "24") {
print ("<img src='/news/images2007b/kiriko-c3po1.jpg'>");
} elseif ($image == "25") {
print ("<img src='/news/images2007b/kiriko-c3po2.jpg'>");
} elseif ($image == "26") {
print ("<img src='/news/images2007b/kiriko-c3po3.jpg'>");
} elseif ($image == "27") {
print ("<img src='/news/images2007b/kiriko-r4p171.jpg'>");
} elseif ($image == "28") {
print ("<img src='/news/images2007b/kiriko-r4p172.jpg'>");
} elseif ($image == "29") {
print ("<img src='/news/images2007b/kiriko-r4p173.jpg'>");

} else {
print ("<p>No image was selected to display</p>");
}
?>
</font>
</tD>
</tr>
</table>


<p> </p>
</BODY>
</span>
</HTML>

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.