Solved

Having fgColor Problem...

Posted on 2004-09-21
4
289 Views
Last Modified: 2010-04-17
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
0
Comment
Question by:ronaldj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
WesleySaysHi earned 250 total points
ID: 12117554
Copy the code,
save the file as html and run it!

<html>
<head>
</head>
<body>
<script language="JavaScript"><!--
function CcolorB2() {  
document.forms[0].text1.style.color="red";
}
//--></script>

The input line is as follows:
<Form name="forms[0]">
<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-->)
<INPUT TYPE="button" VALUE=" Yes " onClick="CcolorB2()" style="float: left">
</Form>
</body>
</html>

Is this what you wanted?

Regards,
Wesley
0
 

Author Comment

by:ronaldj
ID: 12117819
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
0
 
LVL 5

Expert Comment

by:WesleySaysHi
ID: 12117960
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
0
 

Author Comment

by:ronaldj
ID: 12117991
Wesley,

I think this should get you there:

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

Pleasant dreams!

Ron
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This is about my first experience with programming Arduino.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question