very simple image gallery !!!

gsingla4u's Avatar, Join Date: Jul 2009
Go4Expert Member
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 shabbir; 27Mar2010 at 21:49.. Reason: Code blocks
gsingla4u's Avatar, Join Date: Jul 2009
Go4Expert Member
no reply !!! ?