Jump to content
SkatePerception
Sign in to follow this  
cherryrig

Add An Image Counter

Recommended Posts

Baiscally I'm using this code here

 

and want to know how I can add an image counter to be displayed, so that it says how many photos there are and which numer it's on.

 

Please say there must be a way of doing this!!!

 

Come on all you webbbb people.............

 

 

Cheers :ph34r:

Share this post


Link to post
Share on other sites

i didn't test it, but this html should work:

 

<table border="0" cellspacing="0" cellpadding="0"> <tr>   <td width="100%" colspan="2" height="22"><center><script>if (linkornot==1)document.write('<a href="java script:transport()">')document.write('<img src="'+photos[0]+'" name="photoslider" style="filter:revealTrans(duration=2,transition=23)" border=0>')if (linkornot==1)document.write('</a>')</script></center></td> </tr> <tr>   <td width="50%" height="21"><p align="left"><a href="#" onClick="backward();return false">Previous Slide</a></td><td width="1%" height="21"><p align="left">	<script>		document.write('Slide ' + which + ' of ' + photos.length);	</script></p></td>   <td width="50%" height="21"><p align="right"><a href="#" onClick="forward();return false">Next Slide</a></td> </tr></table>

 

Share this post


Link to post
Share on other sites

It gets the number up like

 

0 of 15

 

but then when you hit next it doesn't write the next number?

 

Almost thereeeee

 

Cheers

 

Corey

 

againnnnnnn

Share this post


Link to post
Share on other sites

oh yah, duh.

 

here ya go:

 

 

<script type="text/javascript">/************************************************ DHTML slideshow script-  © Dynamic Drive DHTML code library (www.dynamicdrive.com)* This notice must stay intact for legal use* Visit http://www.dynamicdrive.com/ for full source code***********************************************/var photos=new Array()var photoslink=new Array()var which=0//define images. You can have as many as you want:photos[0]="photo1.jpg"photos[1]="photo2.jpg"photos[2]="photo3.jpg"//Specify whether images should be linked or not (1=linked)var linkornot=0//Set corresponding URLs for above images. Define ONLY if variable linkornot equals "1"photoslink[0]=""photoslink[1]=""photoslink[2]=""//do NOT edit pass this linevar preloadedimages=new Array()for (i=0;i<photos.length;i++){preloadedimages[i]=new Image()preloadedimages[i].src=photos[i]}function applyeffect(){if (document.all && photoslider.filters){photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)photoslider.filters.revealTrans.stop()photoslider.filters.revealTrans.apply()}}function playeffect(){if (document.all && photoslider.filters)photoslider.filters.revealTrans.play()}function keeptrack(){window.status="Image "+(which+1)+" of "+photos.length}function backward(){if (which>0){which--document.getElementById('count').innerHTML = which + 1;applyeffect()document.images.photoslider.src=photos[which]playeffect()keeptrack()}}function forward(){if (which<photos.length-1){which++document.getElementById('count').innerHTML = which + 1;applyeffect()document.images.photoslider.src=photos[which]playeffect()keeptrack()}}function transport(){window.location=photoslink[which]}</script><table border="0" cellspacing="0" cellpadding="0"><tr><td width="100%" colspan="2" height="22"><center><script>if (linkornot==1)document.write('<a href="java script:transport()">')document.write('<img src="'+photos[0]+'" name="photoslider" style="filter:revealTrans(duration=2,transition=23)" border=0>')if (linkornot==1)document.write('</a>')</script></center></td></tr><tr><td width="50%" height="21"><p align="left"><a href="#" onClick="backward();return false">Previous Slide</a></td><td width="1%" height="21"><p align="left">Slide <span id="count">1</span> of <script>document.write(photos.length);</script></p></td><td width="50%" height="21"><p align="right"><a href="#" onClick="forward();return false">Next Slide</a></td></tr></table>

 

Share this post


Link to post
Share on other sites

Cheers for that

 

but.....................

 

For some reason I'm only getting a forward arrow no back arrow any more??

 

 

EDIT - Fixed it!!!

 

I just added the applyeffect() below what I had on my code for the buttons already so then it would read all that 1st then add on after (well thats my reason behind it!!)

 

 

var preloadedimages=new Array()for (i=0;i<photos.length;i++){preloadedimages[i]=new Image()preloadedimages[i].src=photos[i]}function applyeffect(){if (document.all && photoslider.filters){photoslider.filters.revealTrans.Transition=Math.floor(Math.random()*23)photoslider.filters.revealTrans.stop()photoslider.filters.revealTrans.apply()}}function playeffect(){if (document.all && photoslider.filters)photoslider.filters.revealTrans.play()}function keeptrack(){window.status="Image "+(which+1)+" of "+photos.length}function backward(){if (which>0){which--document.images.photoslider.src=photos[which]keeptrack()}if (which==0){document.getElementById('backward').style.visibility='hidden';}if (which>0){document.getElementById('forward').style.visibility='visible';document.getElementById('count').innerHTML = which + 1;applyeffect()}}function forward(){if (which<photos.length-1){which++document.images.photoslider.src=photos[which]keeptrack()}if (which==photos.length-1){document.getElementById('forward').style.visibility='hidden';}if (which>0){document.getElementById('backward').style.visibility='visible';document.getElementById('count').innerHTML = which + 1;applyeffect()}}function transport(){window.location=photoslink[which]}</script>

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×