DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2007
    Posts
    6

    comboBox onfocus=this.style.backgroundColor = '#FFFFFF' cause click twice.

    I have one textbox and one combobox right now. The problem is , i set onfocus for text area and when i click on it, the textbox colour will change. I use the same method for combobox but it turned out that i click 1st time, background colour changed... click 2nd time, then only the combobox list is shown.

    Thanks again
    Last edited by drumhitz; 09-06-2007 at 05:43 AM.

  2. #2
    Join Date
    Jan 2005
    Posts
    413
    I'm not sure I understand. What do you mean only the combo box list is shown? Are you saying the text box disappears? Or the color no longer displays?

  3. #3
    Join Date
    Sep 2007
    Posts
    6
    Sorry to make you confused actually, forget the textbox part. Im using the 'onfocus' for my combobox. I want the effect to be like when I click it, it will change it background colour and list down the menu.

    Now my case is when i clicked 1st time, the background colour changed, I need to click 2nd time then only the list is drop down.

    Can this be solved? many thanks...

  4. #4
    Join Date
    Jan 2005
    Posts
    413
    So you're saying on the 1st click the box doesn't drop down? Change the event from onfocus to onclick.

  5. #5
    Join Date
    Sep 2007
    Posts
    6
    I changed it to onclick but the problem remains. Need to click twice then only the list will drop down and stay still.


    onclick=" this.style.borderWidth = '2px'; this.style.backgroundColor = '#FFFFFF' "

    Everytime the colour changed, the dropdownlist will automatically close. I'm thinking to have a javascript to make the dropdownlist open and stay still automatically after it closed at the 1st time. Is this possible ?

    Thanks

  6. #6
    Join Date
    Jan 2005
    Posts
    413
    I just tested and it works fine here. Only issue I see is that in IE6 the options background doesn't change, just the select box itself. You'll probably have to change the options backgrounds also, for IE

  7. #7
    Join Date
    Sep 2007
    Posts
    6
    fyi..

    I'm using IE 7 and it still cannot work, need to click twice only the combobox will drop down the list and stay still. If click once , I can notice the list drop down but it immediately turn off and user cannot select the option in it.

    I try to use Firefox and the problem is solved. How to settle the problem in IE 7 ? On the other hand, can you show me the java script on how you make the combo box drop down its list?

    Many thanks

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links