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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Slide Show Tutorial Help

    brilliant script below but I can't get it to work for 4 images. Any helpers ?

    <html>
    <head>
    <script language="JavaScript1.1">
    <!--
    //preload images
    var image1=new Image()
    image1.src="firstimage.gif"
    var image2=new Image()
    image2.src="secondimage"
    var image3=new Image()
    image3.src="thirdimage.gif"
    //-->
    </script>
    </head>
    <body onLoad="slideit()">
    <a href="javascript:slidelink()"><img src="firstimage.gif" name="slide" border=0 style="filter:blendTrans(duration=3)"></a>
    <script>
    <!--
    var step=1
    var whichimage=1
    function slideit(){
    if (!document.images)
    return
    //If the browser is IE 4.x
    if (document.all)
    slide.filters.blendTrans.apply()
    document.images.slide.src=eval("image"+step+".src")
    //If the browser is IE 4.x
    if (document.all)
    slide.filters.blendTrans.play()
    whichimage=step
    if (step<3)
    step++
    else
    step=1
    setTimeout("slideit()",5000)
    }
    function slidelink(){
    if (whichimage==1)
    window.location="link1.htm"
    else if (whichimage==2)
    window.location="link2.htm"
    else if (whichimage==3)
    window.location="link3.htm"
    }
    //-->
    </script>
    </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Provo, UT
    Posts
    142
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <html>
    <head> 
    <script language="JavaScript1.1"> 
    <!-- 
    //preload images 
    var image1=new Image() ;
    image1.src="firstimage.gif" 
    var image2=new Image() ;
    image2.src="secondimage" ;
    var image3=new Image() ;
    image3.src="thirdimage.gif" ;
    var image4=new Image();
    image4.src="fourthimage.gif";
    //--> 
    </script> 
    </head> 
    <body onLoad="slideit()"> 
    <a href="javascript:slidelink()"><img src="firstimage.gif" name="slide" border=0 style="filter:blendTrans(duration=4)"></a> 
    <script> 
    <!-- 
    var step=1 
    var whichimage=1 
    function slideit(){ 
    if (!document.images) 
    return 
    //If the browser is IE 4.x 
    if (document.all) 
    slide.filters.blendTrans.apply() 
    document.images.slide.src=eval("image"+step+".src") 
    //If the browser is IE 4.x 
    if (document.all) 
    slide.filters.blendTrans.play() 
    whichimage=step 
    if (step<4) 
    step++ 
    else 
    step=1 
    setTimeout("slideit()",5000) 
    } 
    function slidelink(){ 
    if (whichimage==1) 
    window.location="link1.htm" ;
    else if (whichimage==2) 
    window.location="link2.htm" ;
    else if (whichimage==3) 
    window.location="link3.htm" ;
    else if (whichimage==4)
    window.location="link4.htm";
    } 
    //--> 
    </script> 
    </body> 
    </html>
    I think this should work. I didn't test it however. Good luck


  •  

    Posting Permissions

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