Welcome visitor
* Login
* Register
It is currently July 19th, 2019, 6:33 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  link to change picture only
PostPosted: October 17th, 2009, 1:11 am 

Posts: 15
Hi, how can I create a link with an image to another image but it shouldnt open in a different page, just replace the current picture.


Top
 Profile  
 
  Re: link to change picture only
PostPosted: October 17th, 2009, 1:57 am 
User avatar

Posts: 136
This is done with javascript. On the pics array you need to add the name of each picture of your gallery.
<script type="text/javascript">
pics = new Array();
pics[0]= 'pic0.jpg';
pics[1]= 'sun.bmp';
pics[2]= 'banner.png';
pics[3]= 'transparent.gif';
pics[4]= 'logo.png';
currentpic = 0;
function shownext(){
nextpic=currentpic+1;
if (nextpic==pics.length){nextpic=0;}
document.getElementById('collection').src=pics[nextpic];
currentpic=nextpic;}
</script>
<img id="collection" src="pic0.jpg" onclick="shownext();" />


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron