Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Use left arrow to go to previous photo and right arrow to go to next photo

Posted on 2006-05-20
6
Medium Priority
?
397 Views
Last Modified: 2008-03-06
Hi

I have a photo gallery with PHP. How can I make it so that when people hit to left arrow goes to previous photo, right arrow to next photo?

Regards
0
Comment
Question by:hasozduru
  • 3
  • 3
6 Comments
 
LVL 17

Accepted Solution

by:
Cem Türk earned 2000 total points
ID: 16726393
here you go;

<html>
<head>
<script type="text/javascript">
function go(e) {
if(!e) var e = window.event;

    if(e.keyCode==37){ //left arrow
        document.location="photo.php?id=3"; //go to previous photo
      }
      else if(e.keyCode==39){ //right arrow
        document.location="photo.php?id=5"; //go to next photo
      
    }
}
document.onkeydown = go
</script>
</head>
<body>
</body>
</html>

0
 

Author Comment

by:hasozduru
ID: 16726428
Cheers cem_turk
0
 
LVL 17

Expert Comment

by:Cem Türk
ID: 16726434
;-) this made me javascript guru (-:
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:hasozduru
ID: 16726450
Cool, what's my present than? (:
0
 
LVL 17

Expert Comment

by:Cem Türk
ID: 16726455
you got your present already :]
0
 

Author Comment

by:hasozduru
ID: 16726478
Ok, that's fine.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question