• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 283
  • Last Modified:

Auto Next Image Link 1.jpg to 9999.jpg

Hi,

I have 1.jpg 2.jpg 3.jpg ....... 9999.jpg different size pictures in a folder. How to make next link for simple navigation ?

Thanks.
0
uyduruk
Asked:
uyduruk
  • 2
  • 2
1 Solution
 
OnthraxCommented:
Use a little javascript for example.

something like:

var x;
x = 0;

function ShowNext() {
    x++;
   document.getElementById("IDofElement").src = "/images/" + x + ".jpg"
}

function ShowPrevious() {
     x--;
    document.getElementById("IDofElement").src = "/images/" + x + ".jpg"
 }

<a href="#" Onclick="ShowNext(); return false">Next</a>
<a href="#" Onclick="ShowPrevious(); return false">Previous</a>

If you need any further assistance please let me know..
0
 
uydurukAuthor Commented:
I never understandig JS. Would you write me all codes with html tag?

I want like this: http://img87.imageshack.us/img87/9043/simplegallery.gif

This is enough for me.

LoL, Thanks
0
 
OnthraxCommented:
I already wrote all the code. Just put the javascript inside a script tag.

<script language="javascript">
var x;
x = 0;

function ShowNext() {
    x++;
   document.getElementById("IDofElement").src = "/images/" + x + ".jpg"
}

function ShowPrevious() {
     x--;
    document.getElementById("IDofElement").src = "/images/" + x + ".jpg"
 }
</script>

Use this as the next and previous link:
<a href="#" Onclick="ShowNext(); return false">Next</a>
<a href="#" Onclick="ShowPrevious(); return false">Previous</a>

And as for the image:
<img id="IDofElement" width="50" height="50" src="/images/1.jpg" />


This is all from the head though, so I might have made a typo or something. Please try this and report back any problems you might encounter.

Hope this helps..
0
 
uydurukAuthor Commented:
Thank you very much for simple javascript solution. I hope I have time to learn basic JS ;)
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now