Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4325338
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:15:12+00:00 2026-05-21T09:15:12+00:00

I’m busy with a e-commerce website and the client wants 3 slide shows running

  • 0

I’m busy with a e-commerce website and the client wants 3 slide shows running next to each other displaying specials or promotions running on the site. I got it right to run the 3 slide shows next to each other but don’t know how to add image links that should you click on that certain special it will take you to the corresponding page.

Please note I’m still a newbie when it comes to JavaScript but I have knowledge of html and css.

Here is the code I used:

This is the code that goes in the head section.

<head>
<script type="text/javascript">
<!--
var Imgs=['/images/specials/1.jpg','/images/specials/2.jpg','/images/specials/3.jpg','/images/specials/4.jpg','/images/specials/5.jpg',];
for (var src,z0=0;z0<Imgs.length;z0++){
src=Imgs[z0];
Imgs[z0]=new Image();
Imgs[z0].src=src;
 }

var Imgs1=['/images/specials/3.jpg','/images/specials/4.jpg','/images/specials/5.jpg','/images/specials/1.jpg','/images/specials/2.jpg',]
for (var src,z0=0;z0<Imgs1.length;z0++){
src=Imgs1[z0];
Imgs1[z0]=new Image();
Imgs1[z0].src=src;
 }

var Imgs2=['/images/specials/5.jpg','/images/specials/1.jpg','/images/specials/4.jpg','/images/specials/2.jpg','/images/specials/3.jpg',];
for (var src,z0=0;z0<Imgs2.length;z0++){
src=Imgs2[z0];
Imgs2[z0]=new Image();
Imgs2[z0].src=src; 
 }

//-->
</script>
</head>

Next the part that goes into the body section of my page

<body>
<img src="/images/1.jpg" id="slide" width="33%" height="300" />
<img src="/images/3.jpg" id="slide1" width="33%" height="300" />
<img src="/images/5.jpg" id="slide1" width="33%" height="300" />

<script type="text/javascript">
<!--

function slideit(o){
this.img=document.getElementById(o.ImageID);
if (this.img){
this.ary=o.ImageArray;
this.ms=o.Duration;
this.cnt=0;
this.to=null;
this.slide();
 }
}

slideit.prototype.slide=function(){
this.img.src=this.ary[this.cnt].src;
this.cnt=++this.cnt%this.ary.length;
var oop=this;
this.to=setTimeout(function(){ oop.slide(); },this.ms);
}

new slideit({
ImageID:'slide'
ImageArray:Imgs,
Duration:4500
});

new slideit({
ImageID:'slide1'
ImageArray:Imgs1,
Duration:5500
});

new slideit({
ImageID:'slide2',
ImageArray:Imgs2,
Duration:6500
});

//-->
</script>
</body>

If its that easy could you please advise me as how and where to add image links to the code above.

Kind regards,
Jakesza

Update

I got the slide to work again what I have noticed is that the script in the body part needs to stay there asoon as I move it to the head section the slide stops working. Also if I add the var=Href parts to the code the slide shows but doesnt transition. Here is a link the page I have been experimenting on.

http://www.compunamics.co.za/test.html

Thanks for your time,

Jakesza

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:15:13+00:00Added an answer on May 21, 2026 at 9:15 am

    Have fun

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title></title>
    <script type="text/javascript"><!--
    var sliderSetup = [
      {
        "id":"slide0",  
        "hrefs":['http://www.google.co.za','http://www.stackoverflow.com','http://www.test.com','http://www.amazon.com','http://www.bidorbuy.co.za'],
        "images":['/images/test/image1.gif','/images/test/image2.gif','/images/test/image3.gif','/images/test/image4.gif','/images/test/image5.gif'],
        "duration":4500
      },
      {
        "id":"slide1",  
        "hrefs":['http://www.bidorbuy.co.za','http://www.stackoverflow.com','http://www.test.com','http://www.amazon.com','http://www.google.co.za'],
        "images":['/images/test/image5.gif','/images/test/image6.gif','/images/test/image7.gif','/images/test/image8.gif','/images/test/image1.gif'],
        "duration":5000
      },
      {
        "id":"slide2",  
        "hrefs":['http://www.google.co.za','http://www.stackoverflow.com','http://www.test.com','http://www.amazon.com','http://www.bidorbuy.co.za'],
        "images":['/images/test/image7.gif','/images/test/image8.gif','/images/test/image1.gif','/images/test/image2.gif','/images/test/image6.gif'],
        "duration":5500
      }
    ];
    
    function slideit(o){
      this.img=document.getElementById(o.ImageID);
      if (this.img){
        this.ary=[];
        for (var i=0;i<o.ImageArray.length;i++) {
          this.ary[i]=new Image(); 
          this.ary[i].src=o.ImageArray[i];
        }
        this.ms=o.Duration;
        this.cnt=0;
        this.hrefs=o.HrefArray;
        this.to=null;
        this.slide();
      }
    }
    
    slideit.prototype.slide=function() {
      this.img.src=this.ary[this.cnt].src;
      this.cnt=++this.cnt%this.ary.length;
      this.img.parentNode.href = this.hrefs[this.cnt];
      var oop=this;
      this.to=setTimeout(function(){ oop.slide(); },this.ms);
    }
    
    window.onload=function() {
      for (var i=0;i<sliderSetup.length;i++) {
        new slideit({
          ImageID:sliderSetup[i].id,
          ImageArray:sliderSetup[i].images,
          HrefArray:sliderSetup[i].hrefs,
          Duration:sliderSetup[i].duration
        });
      }
    }
    
    
    //-->
    </script>
    </head>
    <body>
    <a href="http://www.google.co.za"><img alt="" src="/images/test/image1.gif" id="slide0" height="150" width="150" /></a>
    <a href="http://www.bidorbuy.co.za"><img alt="" src="/images/test/image5.gif" id="slide1" height="150" width="150" /></a>
    <a href="http://www.test.com"><img alt="" src="/images/test/image3.gif" id="slide2" height="150" width="150" /></a>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I am currently running into a problem where an element is coming back from
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.