...

View Full Version : textfield background color in javascript



magyar
08-20-2005, 07:29 PM
Hello,
I have a register form on my site. The user fills it out then hits 'Register'.
If the user name already exists then he is sent back to the register form and I want the username field background color to be gray as well as to be focused. I have this code:

function blinkhere() {
if (document.login.fname.value == "")
{document.login.fname.focus();}
else
{document.login.user.focus();
document.login.user.backgroundColor(#999999);}

<BODY onLoad="blinkhere();">

What is the correct line of code referring to background color above??

Thanks your help
magyar

Mr J
08-20-2005, 09:25 PM
Try

document.login.user.style.backgroundColor="#999999"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum