Aiiiii. The code is lovely but it only does the decrement for the back button twice. I'm at a loss. How can I get that php code at the top to check $paintingBack more than twice? I would appreciate any help. Thank you. Here's the code: <?php $paintingBack=$paintingNumber-1; $paintingNext=$paintingNumber+1; if ($paintingBack < 1) { $paintingBack = $paintingBack + 1; } ?> <a href="" id="link1" class='link'><img src='images/braceL.gif' alt='brace' width='20' height='11' valign='text-bottom'/></a> <script type="text/javascript"> var l = document.getElementById("link1"); l.onFocus = function() { if(this.blur)this.blur(); } l.onclick = function() { document.getElementById("paintingImage").innerHTML = "<img src='images/painting_<? echo $paintingBack; ?>.jpg' />"; return false; } </script> <a href="thumbnails.php" class="linkCurrent" target="_self" onFocus="if(this.blur)this.blur)" />PAINTINGS</a> <a href="painting_<?php echo $paintingNext; ?>.php" class="link" target="_self" onFocus="if(this.blur)this.blur()" /><img src="images/braceR.gif" alt="brace" width="20" height="14" valign="text-bottom" onFocus="if(this.blur)this.blur()" /></a> Code (markup):
What I need to do is loop through this code. <?php $paintingBack=$paintingNumber-1; $paintingNext=$paintingNumber+1; if ($paintingBack < 1) { $paintingBack = $paintingBack + 1; } ?> <a href="" id="link1" class='link'><img src='images/braceL.gif' alt='brace' width='20' height='11' valign='text-bottom'/></a> <script type="text/javascript"> var l = document.getElementById("link1"); l.onFocus = function() { if(this.blur)this.blur(); } l.onclick = function() { document.getElementById("paintingImage").innerHTML = "<img src='images/painting_<? echo $paintingBack; ?>.jpg' />"; return false; } </script> Code (markup):