Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8865383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:29:33+00:00 2026-06-14T16:29:33+00:00

Prior to adding this code to my page, if, when executed, I notice that

  • 0

Prior to adding this code to my page, if, when executed, I notice that all of my select boxes take 2 clicks of the user to open the drop down menu, the first click seems like it sets focus on it, then the 2nd click finally opens it. If I remove the code, the behaviour changes, and the user is able to open the drop down with all of its menu options in only 1 single click.

I am not sure what to fix or modify, so that it doesn’t take 2 clicks, im also using ie. 7 so this would be a work around of css focus. I do not wish to have any jquery please.

Thanks for all your help.

function v9_form() {
//===========================================================================================>>
    var x = document.getElementsByTagName('INPUT');
    for (var i = 0; i < x.length; i++) {
            if (x[i].type == "text" && x[i].readOnly == false) {            
        if (x[i].id != "date2" && x[i].id != "date3") {

            x[i].onfocus = function() { this.style.backgroundColor = '#FFFFC4';};

            x[i].onblur = function() {  this.style.backgroundColor = '#FFFFFF';};
        }   


            }//end of if
    }//end of for

    var y = document.getElementsByTagName('SELECT');
    for (var i = 0; i < y.length; i++) {
            y[i].onfocus = function() { this.style.backgroundColor = '#FFFFC4'; };
            y[i].onblur = function() { this.style.backgroundColor = '#FFFFFF'; };
    }

    var z = document.getElementsByTagName('TEXTAREA');
    for (var i = 0; i < z.length; i++) {
            z[i].onfocus = function() { this.style.backgroundColor = '#FFFFC4'; };
            z[i].onblur = function() { this.style.backgroundColor = '#FFFFFF'; };
    }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:29:34+00:00Added an answer on June 14, 2026 at 4:29 pm

    This is a known issue with IE. If you change any of the style in the onfocus IE doesn’t display the dropdown choices.

    A solution is to use the onfocusin event for IE:

    y[i].onfocusin = function() { this.style.backgroundColor = '#FFFFC4'; }
    

    From MSDN:

    Fires for an element just prior to setting focus on that element.

    Another option is to use the :focus CSS selector but you’re obviously limited to CSS with that, no complex Javascript logic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got c++ code that needs a sed done to it prior to compilation.
Prior to C++11, if I had a function that operated on large objects, my
Prior to Excel 2007, we used to catch the open file event in Excel
Introduction : I have prior experience in programming (C, C++, Java), however, this is
This is only an issue on GCC versions prior to 4.4, this was fixed
I'm building an application that opens existing mail messages in Outlook. The user may
I have a JSF2 application and a page with the following code: <h:inputText id=someInput
This follows this prior question, which was answered. I actually discovered I could remove
I'm showing the code to this problem for example purposes, but really my question
I am writing a decorator that needs to call other functions prior to call

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.