...

View Full Version : How to compare text box's background color



ali.irfan
05-15-2009, 06:35 AM
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")

adios
05-15-2009, 06:57 AM
Why not pop up an alert, and see what's in there? Never assume a value is what you think it should be.


javascript:alert(document.getElementById('myName').style.backgroundColor);

Just dump it in the address bar, and hit enter.

This (http://oreilly.com/pub/a/javascript/excerpt/JSDHTMLCkbk_chap5/index5.html) might help. A little dated, but still useful.

ali.irfan
05-18-2009, 05:36 AM
Thanks i have tried and it is working



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum