SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy slideshow is a no show

    http://www.thestreettheatreadvertisi...eshow_test.htm

    Hello!
    My first attempt at a slideshow (see above url) has ended up as a no show.
    Nothing happens. I've checked all manner of things but have got so tired now I need a fresh pair of eyes to see if they can spot where things have gone wrong
    I worked from a tutorial - http://www.webmonkey.com/webmonkey/0...tw=programming

    Any suggestions welcome...

    oh and the code..
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     <script language="JavaScript">
    var interval = 1500;
    var random_display = 0;
    var imageDir = "img/ ";
    var imageNum = 0;
    imageArray = new Array();
    imageArray[imageNum++] = new imageItem(imageDir + "minster_1.jpg");
    imageArray[imageNum++] = new imageItem(imageDir + "cliffords_tower.jpg");
    imageArray[imageNum++] = new imageItem(imageDir + "constantine.jpg");
    imageArray[imageNum++] = new imageItem(imageDir + "heslington.jpg");
    var totalImages = imageArray.length;
    function imageItem(image_location) {
    this.image_item = new Image();
    this.image_item.src = image_location;
    }
    function get_ImageItemLocation(imageObj) {
    return(imageObj.image_item.src)
    }
    function randNum(x, y) {
    var range = y - x + 1;
    return Math.floor(Math.random() * range) + x;
    }
     function getNextImage() {
    if (random_display) {
    imageNum = randNum(0, totalImages-1);
    }
    else {
    imageNum = (imageNum+1) &#37; totalImages;
    }
    var new_image = get_ImageItemLocation(imageArray[imageNum]);
    return(new_image);
    }
     function getPrevImage() {
    imageNum = (imageNum-1) % totalImages;
    var new_image = get_ImageItemLocation(imageArray[imageNum]);
    return(new_image);
    }
     function prevImage(place) {
    var new_image = getPrevImage();
    document[place].src = new_image;
    }
    function switchImage(place) {
    var new_image = getNextImage();
    document[place].src = new_image;
    var recur_call = "switchImage('"+place+"')";
    timerID = setTimeout(recur_call, interval);
    </script>
    </head>
    <body>
     <img name="Minster" src="img/minster_1.jpg" width=200 height=134 border=0>
    <p>test</p>
    </body>
    </html>
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com

  2. #2
    SitePoint Guru Zygoma's Avatar
    Join Date
    May 2006
    Location
    York, Uk
    Posts
    916
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    problem solved thanks to: http://www.javascriptkit.com/howto/show2.shtml

    But does anyone have any idea how to do a fade in fx between images?
    I have had a perfectly wonderful
    evening, but this wasn't it-
    Julius "GROUCHO" Marx - 1890-1977
    http://www.davidclick.com


Bookmarks

Posting Permissions

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