Event Counter in JavaScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ernst Lindner
    New Member
    • Apr 2006
    • 1

    Event Counter in JavaScript

    Hello,
    hopefully somebody can help me.

    In my homepage I would like to install a picture gallery (small pictures).

    If the user places the mouse over a picture, by using the event handler MouseOver in JavaScript, the picture is resized.

    In order to generate a kind of hit list for the pictures (which picture is most interesting) , I would like to count up all MouseOver Events related to the pictures respectively.

    Is it possible to generate a counter for this?
    Do anybody has an idea for the problem?

    Thank you in advance.

    Sincerely

    Ernst Lindner
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Most probably you'd want a counter for all visitors, not just a local count.

    For this, you can make an Ajax request to update the count on the server. However, with multiple mouse over events, this may cause problems. To solve this, keep an array of integers which stores the number of mouse events for each picture, then make one request every minute or so to update the counters.

    Comment

    Working...