www.webdeveloper.com
Results 1 to 2 of 2

Thread: Feature swap with next/previous buttons

  1. #1
    Join Date
    Jul 2009
    Posts
    1

    Feature swap with next/previous buttons

    Hi all

    First off, apologies if I leave out info - a bit new to js.

    I have some script on a new site that has four little images in a row on the right of the page, which, when you click on each of those images, a bigger image, as well as some copy, comes up on the right. I was recently told that the customers want next/previous arrows around the four little images so they 'know' that the images do something 'else'.

    Basically what I need is some script that will make the next and previous buttons work, keeping in mind that the 'onclick' of those will need to load not just an image, but copy as well.

    This is the current script:
    Code:
    <SCRIPT LANGUAGE="JavaScript" type="text/javascript">
    function LoadFeature(WhichFeat){
    var FeatureImages=new Array();
    var FeatureCopy=new Array();
    				
    FeatureImages[0]=link and image;
    FeatureImages[1]=link and image;
    FeatureImages[2]=link and image;
    FeatureImages[3]=link and image;
    				
    FeatureCopy[0]=<p>Text relating to FeatureImages(0)</p>;
    FeatureCopy[1]=<p>Text relating to FeatureImages(1)</p>;
    FeatureCopy[2]=<p>Text relating to FeatureImages(2)</p>;
    FeatureCopy[3]=<p>Text relating to FeatureImages(3)</p>;
    												
    $("#features-inner-left").empty();
    $("#feature-text").empty();			
    $("#features-inner-left").html(FeatureImages[WhichFeat]);
    $("#feature-text").html(FeatureCopy[WhichFeat]);
    }
    </script>
    <body>
    <a href="javascript:LoadFeature(0);"><img src="0.jpg" /></a>
    <a href="javascript:LoadFeature(1);"><img src="1.jpg" /></a>
    <a href="javascript:LoadFeature(2);"><img src="2.jpg" /></a>
    <a href="javascript:LoadFeature(3);"><img src="3.jpg" /></a>
    </body>
    I guess I would like the next and previous buttons to load those features whenever they're clicked (like +1 or something). Looking forward to your help!! Thanks.

  2. #2
    Join Date
    Oct 2006
    Posts
    939
    You may presume too much, that we can follow whats going on.

    is this some PHP?

    $("#features-inner-left").empty();
    $("#feature-text").empty();
    $("#features-inner-left").html(FeatureImages[WhichFeat]);
    $("#feature-text").html(FeatureCopy[WhichFeat]);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles