Results 1 to 2 of 2

Thread: Simple JavaScript slideshow, first image error

  1. #1
    Join Date
    Mar 2005
    Posts
    10

    Simple JavaScript slideshow, first image error

    This is a simple problem, so I won't waste any time writing some huse paragraph about what's wrong. A simple website I've made for my class has a problem with its slideshow: the 'next' button does nothing on the first click. On the second it goes to the next image and everything is fine from there. But it's pretty annoying. Can anyone help me out?

    page source: http://pastebin.com/m3c40cbaa
    (pastebin sort of botched the formatting. Just ignore it.)

  2. #2
    Join Date
    May 2009
    Location
    England
    Posts
    165
    HI bugmenot,

    I'm not sure if this is the solution but it's certainly something that might held.

    num is set to 1 when the page loads.

    Then, when you call the function you are immediately incrementing 1, so the slide show starts at 2.

    If you set num to 0 in the initialisation the first image will show.

    I'm not sure how that relates to the issue with clicking twice but I trust it helps.

    Regards,


    David
    David McLeary
    Emerging Innovations
    Website Development, Training and Consultancy

Similar Threads

  1. A new simple way to make a image slider- Javascript Code
    By o0DarkEvil0o in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 18 May 2008, 04:52 PM
  2. Simple Javascript Image Rollovers
    By kirstybandm in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 1
    Last Post: 02 Aug 2006, 06:19 AM
  3. Problem with javascript Slideshow and transparent PNG files
    By moez in forum Client & Server Side Scripting (PHP, ASP, JavaScript)
    Replies: 0
    Last Post: 20 Jan 2006, 02:56 PM

Posting Permissions

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