Link to home
Start Free TrialLog in
Avatar of ronaldj
ronaldj

asked on

Having fgColor Problem...

The following JS routine changes the textbox background to red:

<script language="JavaScript"><!--
function CcolorB2() {  document.forms[0].text1.style.backgroundColor="#FF0000";
    }
//--></script>

The button which triggers is coded as:

<INPUT TYPE="button" VALUE=" Yes " onClick="CcolorB2()" style="float: left">

The input line is as follows:

<input type="text" name="text1" value="First Name" size="20" style="color: #FFFFFF  border: 1px solid #FFFFFF; background-color: #FFFFFF"> (<--background, text and border all white-->)

What I REALLY want to do is have the text change to RED, not the background...have tried different combinations of fgColor and foregroundColor in place of backgroundColor but I can't seem to get this to work. How should the line 'document.forms[0].text1...' be coded? Help please.

Thanks,
Ron
ASKER CERTIFIED SOLUTION
Avatar of WesleySaysHi
WesleySaysHi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ronaldj
ronaldj

ASKER

Wesley,

You're the man! Works in both NN & IE...didn't need to name form since by default implied name is forms[0]. Thanks again. I have an open ? from yesterday re: parent/child relationship... code is exactly the same, works on one server, not another...bizzare! Take a look and see if you have any thoughts.

Ron
Where's that open? Place a link please. It's already 3 AM and I'm messing things up. Before answering your question here, I wrote the answer by mistake in a PAQ from August and I have no idea how to erase it from there. I really need to sleep now, but if you place the link, I'll read about your 'parent/child relationship' in a few hours.

Wesley
Avatar of ronaldj

ASKER

Wesley,

I think this should get you there:

https://www.experts-exchange.com/Programming/viewQuestionHistory.jsp?mid=1533350&orderBy=9&sort=1

Pleasant dreams!

Ron