SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    detect mouse event in php

    hi,
    can php detect mouse event ? like onclick ,onmouse out ...etc ?
    If yes what is the function used ?

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Nope, JavaScripts' place
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you should start watching the mouse events using the JS then should in someway with ajax to php..

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,785
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The PHP runs completely before the page is sent to the browser so by the time the first mose evnet happens all your page has in it is HTML, CSS, and JavaScript.

    For PHP to be able to process based on mouse events you need to detect the event using JavaScript and then call the PHP from the JavaScript (this process is usually called Ajax).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Addict
    Join Date
    Jul 2008
    Location
    sudo rm -rf /
    Posts
    386
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can detect mouse movements with Javascript and send AJAX request to PHP page to do some action and return data.

  6. #6
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,015
    Mentioned
    62 Post(s)
    Tagged
    0 Thread(s)
    http://www.prototypejs.org is one of the better AJAX frameworks and it handles events in a classical object oriented manner. It's where you'll need to start reading to deal with this stuff - but be warned that it isn't easy.

  7. #7
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Michael Morris View Post
    http://www.prototypejs.org is one of the better AJAX frameworks and it handles events in a classical object oriented manner. It's where you'll need to start reading to deal with this stuff - but be warned that it isn't easy.
    That's debatable but IMO for a novice web developer it's much easier using a well established API such as the one provided by jQuery or Prototype as opposed to straight up DOM Scripting and having to account for a whole slew of cross browser DOM API bugs.
    Cross browser css bugs

    Dan Schulz you will be missed


Bookmarks

Posting Permissions

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