www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 02-09-2006, 12:57 PM
    idn idn is offline
    Registered User
     
    Join Date: Dec 2005
    Posts: 108
    Detirmining if an element has focus

    Hi, I was wondering if there way a way to detirmine if an element has focus or not? I want to use it in an if statement, for example:

    if (elem.isFocused()) {

    }

    does anyone know how to do this?

    Thanks!
    Reply With Quote
      #2  
    Old 02-09-2006, 04:30 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,804
    Something to play with
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    	"http://www.w3.org/TR/html4/strict.dtd">
    <html dir="ltr" lang="en">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta http-equiv="content-style-type" content="text/css">
    <meta http-equiv="content-script-type" content="text/javascript">
    <title></title>
    <style type="text/css">
    body {
    	margin:5px;
    	background:#ffffff;
            color:#000000;
    }
    </style>
    <script type="text/javascript">
    onload=function(){
    var elem=document.getElementById("myInputField")
    elem.isFocused=false;
    elem.onfocus=function(){this.isFocused=true}
    elem.onblur=function(){this.isFocused=false}
    
    setInterval(
    
    function(){
    var elem=document.getElementById("myInputField")
    elem.value="elem.isFocused="+elem.isFocused
    }
    ,100
    )
    
    }
    
    </script>
    </head>
    <body>
    <div>
    <input type="text" id="myInputField" value="" readonly="readonly">
    </div>
    </body>
    </html>
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes 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 Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 07:22 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.