Hi, Complete newbie with JS.
Looking for ideas on JavaScript code to change an image on button-click.
My website is "under construction", the image changes are to show it is a "working" holding page.
Hopefully to keep visitors' interest.
(The library of images will be changed fairly often while the site is built).
Several images available, all with same name plus a number ...
eg: ppImg1, ppImg2, ... ppImg9, ppImg10, etc.
Basic idea is to have a counter set to zero the first time the page is brought up.
Then incremented whenever the "Change Picture" button is clicked.
Any advice / comments / links are welcome.
:smiley: cheers
Not quite what you're asking for
See my Swapping Images demo. It should give you a start. Where I used a separate, explicit link for each image, have your js loop through the list of image links.
Your goal of switching on click is good from the user's viewpoint. Auto-changing 'slide shows' are annoying. As a user, I prefer the use of thumbnails over a blind change. It means I can go/return to the image/s that interest me instead of having to cycle through or wait for the slide to come up.
Please pardon the condition of my site. I've been retired for quite a while and have let maintenance slip badly.
gary