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 05-15-2009, 06:35 AM   PM User | #1
ali.irfan
New to the CF scene

 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
ali.irfan is an unknown quantity at this point
Exclamation How to compare text box's background color

Hi
How to compare background color of a textbox ,
i have tried the following code but it is not working

if(document.getElementById('myName').style.backgroundColor=='rgb(254,204,204)')
and
if(document.getElementById('myName').style.backgroundColor=="#fcc")
ali.irfan is offline   Reply With Quote
Old 05-15-2009, 06:57 AM   PM User | #2
adios
Senior Coder

 
Join Date: Jun 2002
Posts: 1,404
Thanks: 2
Thanked 32 Times in 32 Posts
adios is on a distinguished road
Why not pop up an alert, and see what's in there? Never assume a value is what you think it should be.

Code:
javascript:alert(document.getElementById('myName').style.backgroundColor);
Just dump it in the address bar, and hit enter.

This might help. A little dated, but still useful.
adios is offline   Reply With Quote
Old 05-18-2009, 05:36 AM   PM User | #3
ali.irfan
New to the CF scene

 
Join Date: May 2009
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
ali.irfan is an unknown quantity at this point
Thanks i have tried and it is working
ali.irfan is offline   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 11:03 PM.


Advertisement
Log in to turn off these ads.