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 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Image onlick to show next image

    Hi, i want to implement a function which the user will click on an image, the image will then change to the next image. On the background, the system also record down how many click(s) have been clicked on the image.

    But i am going to run this javascript function on php. That means the picture will be retrieve from database. Is it possible for me to do so ?

    I tried to look for some tutorial for image onclick event online. However, they only retrieve the data from client side. May i know is it okay to retrieve the image from server side by javascript ?

    Thanks for helping
    I appreciate your effort a lots

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Location
    London
    Posts
    152
    Thanks
    4
    Thanked 42 Times in 42 Posts
    Not sure about php (haven't worked on that)... But we used to do this using java (jsp and servlet).

    The concept was -
    1) set source of the image as your server file, rather then an image file. Something like -
    Code:
    <img src="/myserver/recordClickPage.php?param1=value1">
    2) on the server, record the click counts and fetch the next image
    3) the next image will be returned from the server (by writing it as binary file)

    I am not sure how this will work in php. All the best !!!

    Regards,
    Niral Soni

  • #3
    New to the CF scene
    Join Date
    Mar 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    THanks

    I would like to say thanks to all user who reply on this topic because i also get this kind of problem and after getting your solution a got my solution.


  •  

    Posting Permissions

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