Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-14-2007, 12:45 AM   PM User | #1
Kerdek
New to the CF scene

 
Join Date: Feb 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Kerdek is an unknown quantity at this point
Help with element focus detection

So, i have a <div> containing an <input>, right?
Now what i need to do is make a onmouseover function for the <div>,
it doesn't matter what the function DOES, but i want an "if" statement in the function that will detect whether or not the <input> has focus.

Anybody know how?
Kerdek is offline   Reply With Quote
Old 02-14-2007, 02:45 AM   PM User | #2
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
Quote:
i want an "if" statement in the function that will detect whether or not the <input> has focus.
Why do you want to detect if the input has focus? Usually, you either need to give focus to something, i.e.:
Code:
document.getElementById('yourInput').focus();
..or you want to remove focus from something:

Code:
document.getElementById('yourInput').blur();
__________________
Regards, R.J.

---------------------------------------------------------

Help spread the word! Like my YouTube-to-Mp3 Web Conversion Software on Facebook !! :)
chump2877 is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:46 AM.


Advertisement
Log in to turn off these ads.