1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

very simple image gallery !!!

Discussion in 'Web Design, HTML And CSS' started by gsingla4u, Mar 27, 2010.

  1. gsingla4u

    gsingla4u New Member

    Joined:
    Jul 27, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    guys i try to make a very basic image gallery, having left and right links to switch the images. thats it.

    i am newbie to js, so try to do it by myself. Here is the code, which is not working:
    Code:
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <img src="" id="img" />
    <a id="lt" href="" onclick="left()">left</a>
    <a id="rt" href="" onclick="right()">right</a>
    <script type="text/javascript">
    var ary1 = ["rcurv.gif","lcurv.gif","midl.gif","plus.gif"];
    var num=0;
    function right(){
            document.getElementById('img').src=ary1[num++];
        }
    function left(){
            document.getElementById('img').src=ary1[num--];
        }
    </script>
    </body>
    </html>
    
    Please help me with the code. :)
     
    Last edited by a moderator: Mar 27, 2010
  2. gsingla4u

    gsingla4u New Member

    Joined:
    Jul 27, 2009
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    0
    no reply !!! ?
     

Share This Page