Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Could someone please tell me what is wrong with this code???

    Could someone please tell me why this doesn't work???
    <html>
    <head>
    <title>slideshow</title>
    </head>
    <body>
    <script type="text/javascript">
    theimage = new Array();
    // The dimensions of ALL the images should be the same or some of them may look stretched or reduced in Netscape 4.
    // Format: theimage[...]=[image URL, link URL, name/description]
    theimage[0]=["http://img844.imageshack.us/img844/981/img3small.jpg", length="380", width="380"];
    theimage[1]=["http://img850.imageshack.us/img850/4371/img2small.gif", length="380", width="380"];
    theimage[2]=["http://img191.imageshack.us/img191/2923/img1small.gif", length="380", width="380"];
    ///// Plugin variables
    playspeed=3000;// The playspeed determines the delay for the "Play" button in ms
    dotrans=1; // if value = 1 then there are transitions played in IE
    transtype='blendTrans';// 'blendTrans' or 'revealtrans'
    transattributes='23';// duration=seconds,transition=#<24
    //#####
    //key that holds where in the array currently are
    i=0;
    //###########################################
    window.onload=function(){
    //preload images into browser
    preloadSlide();
    //set transitions
    GetTrans();
    //set the first slide
    SetSlide(0);
    //autoplay
    PlaySlide();
    }
    //###########################################
    function SetSlide(num) {
    //too big
    i=num%theimage.length;
    //too small
    if(i<0)i=theimage.length-1;
    //switch the image
    if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Appl y()')
    document.images.imgslide.src=theimage[i][0];
    if(document.all&&!window.opera&&dotrans==1)eval('document.images.imgslide.filters.'+transtype+'.Play ()')
    }
    //###########################################
    function PlaySlide() {
    if (!window.playing) {
    PlayingSlide(i+1);
    if(document.slideshow.play){
    document.slideshow.play.value=" Stop ";
    }
    }
    else {
    playing=clearTimeout(playing);
    if(document.slideshow.play){
    document.slideshow.play.value=" Play ";
    }
    }
    // if you have to change the image for the "playing" slide
    if(document.images.imgPlay){
    setTimeout('document.images.imgPlay.src="'+imgStop+'"',1);
    imgStop=document.images.imgPlay.src
    }
    }
    //###########################################
    function PlayingSlide(num) {
    playing=setTimeout('PlayingSlide(i+1);SetSlide(i+1);', playspeed);
    }
    //###########################################
    //desc: picks the transition to apply to the images
    function GetTrans() {
    //si=document.slideshow.trans.selectedIndex;
    if((document.slideshow.trans && document.slideshow.trans.selectedIndex == 0) || (!document.slideshow.trans && dotrans==0)){
    dotrans=0;
    }
    else if ((document.slideshow.trans && document.slideshow.trans.selectedIndex == 1) || (!document.slideshow.trans && transtype == 'blendTrans')){
    dotrans=1;
    transtype='blendTrans';
    document.imgslide.style.filter = "blendTrans(duration=1,transition=1)";
    }else{
    dotrans=1;
    transtype='revealtrans';
    if(document.slideshow.trans) transattributes=document.slideshow.trans[document.slideshow.trans.selectedIndex].value;
    document.imgslide.style.filter = "revealTrans(duration=1,transition=" +transattributes+ ")";
    }
    }
    //###########################################
    function preloadSlide() {
    for(k=0;k<theimage.length;k++) {
    theimage[k][0]=new Image().src=theimage[k][0];
    }
    }
    </script>
    <form name="slideshow">
    <table style="width: 502px; height: 358px;" border="1"
    cellpadding="2" cellspacing="0">
    <tbody>
    <tr>
    <td align="center">
    <a href="#"
    onmouseover="this.href=theimage[i][1];return false">
    <script type="text/javascript">
    document.write('<img name="imgslide" id="imgslide" src="'+theimage[0][0]+'" border="0">')
    </script></a></td>
    </tr>
    </tbody>
    </table>
    </form>
    </body>
    </html>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    In what way does it not work?

    You do know, I hope, that style.filter is strictly an MSIE-ism? It won't do anything at all in other browsers.

    There are other, much much better, slide shows out there with transition effects that work in all modern browsers. That code looks like a refugee from about year 2000.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Dec 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I'm using Kompozer and when I test it all I'm getting is a box with no pictures. Could you help me out with a good slideshow? I just want a faded transition.

  • #4
    New Coder
    Join Date
    Dec 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    OK it does work I was just doing it wrong. Could you still help me out with a slideshow?

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,147
    Thanks
    203
    Thanked 2,547 Times in 2,525 Posts
    Quote Originally Posted by Halcyon1967 View Post
    OK it does work I was just doing it wrong. Could you still help me out with a slideshow?
    See Old Pedant's advice in Post #2.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,561
    Thanks
    80
    Thanked 4,496 Times in 4,460 Posts
    One that I just started working with that I like is here:
    http://www.twospy.com/galleriffic/

    But it's a bit of overkill for a 3-image slideshow if that's really all you have.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #7
    New Coder
    Join Date
    Dec 2011
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Ok thanks.


  •  

    Posting Permissions

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