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 9 of 9
  1. #1
    New Coder
    Join Date
    Nov 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Image Help Quick

    i have this script (below) and was wondering what would i add to that to make the images display random?

    Code:
    <html>
    <head>
    <script language="JavaScript1.1">
    <!--
    //preload images
    var image1=new Image()
    image1.src="firstcar.gif"
    var image2=new Image()
    image2.src="secondcar"
    var image3=new Image()
    image3.src="thirdcar.gif"
    //-->
    </script>
    </head>
    <body>
    <a href="java_script_:slidelink()"><img src="firstcar.gif" name="slide" border=0 width=100 height=56></a>
    <script>
    <!--
    var step=1
    var whichimage=1
    function slideit(){
    if (!document.images)
    return
    document.images.slide.src=eval("image"+step+".src")
    whichimage=step
    if (step<3)
    step++
    else
    step=1
    setTimeout("slideit()",1800)
    }
    slideit()
    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
    New Coder
    Join Date
    Nov 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    please?

  • #3
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,240
    Thanks
    203
    Thanked 2,554 Times in 2,532 Posts
    Here's a link which should help you:-

    http://www.codingforums.com/showthre...t=random+image

    Bear in mind that you probably do not want your
    image selection truly random as in that case
    the same image can be randomly selected twice
    and thus repeat.

  • #4
    New Coder
    Join Date
    Nov 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks!
    is therw anyway to make each i mage have a link like in my script? and i would like to know how to modify mine to be random.

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,240
    Thanks
    203
    Thanked 2,554 Times in 2,532 Posts
    If you search the threads in this forum you will find several
    which cover your question.

  • #6
    New Coder
    Join Date
    Nov 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry - no matches. Please try some different terms.

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,240
    Thanks
    203
    Thanked 2,554 Times in 2,532 Posts
    Funny. I searched for

    random image

    and got 65 threads.

  • #8
    New Coder
    Join Date
    Nov 2003
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i want a random rotator

  • #9
    Regular Coder
    Join Date
    Aug 2002
    Location
    Silicon Valley, CA
    Posts
    980
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Give it a little more effort. We're here to assist, not to do this for you. Nobody here is paid, so nobody is required to do anything. We're willing to help you, but you need to be willing to help yourself as well.


  •  

    Posting Permissions

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