get mouse focus in PHP

Discussion in 'PHP' started by mahdi_fci3, Jul 28, 2010.

  1. #1
    hi all
    I would like to get the mouse focus (which text field the mouse is on ) using PHP,
    for example if the form containe some text field : username,password,country,city and TEL after I submit the form I need to get if the mouse is on username or password or ..etc. So is there a way using PHP
    thank 4 ur time
     
    mahdi_fci3, Jul 28, 2010 IP
  2. upl8t

    upl8t Peon

    Messages:
    80
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What are you trying to accomplish? When someone submits a form the focus is going to be on the submit button. Javascript has a complete set of event handlers for mouse activity.... on focus, on click etc... W3schools has a good javascript reference available for these.
     
    upl8t, Jul 28, 2010 IP
  3. guardian999

    guardian999 Well-Known Member

    Messages:
    376
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #3
    use javascript
     
    guardian999, Jul 28, 2010 IP
  4. c_programmer

    c_programmer Peon

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    PHP can not do this, you need to use javascript.
     
    c_programmer, Jul 28, 2010 IP
  5. ThePHPMaster

    ThePHPMaster Well-Known Member

    Messages:
    737
    Likes Received:
    52
    Best Answers:
    33
    Trophy Points:
    150
    #5
    As explained above, you will need to use Javascript or Ajax (if you want to do it interactively). The Javascript code to do such action is:

    document.getElementById('FIELDID').focus();
     
    ThePHPMaster, Jul 28, 2010 IP