Advertisement

04.30.2008 at 10:19PM PDT, ID: 23367665
[x]
Attachment Details

urgent   textbox - change text color on multiple boxes

Asked by webdott in JavaScript, Hypertext Markup Language (HTML), Scripting Languages

Tags: javascript html script

i have the following code that works great on a disabled text box, but it only works on one text box.

can you help me figure out how to make this work with mutliple boxes?

thanks

my code:
<HTML>
 <HEAD>
 
  <TITLE>Untitled</TITLE>

  <SCRIPT LANGUAGE="javascript">
<!--
function setStyle(){
     var objForm = document.forms[0]
     if(objForm.elements['field1'].checked){
          objForm.elements['textarea1'].style.color = "red";
     }else{
          objForm.elements['textarea1'].style.color = "black";
     }
}

function setDisabled(objControl){
     var objForm = document.forms[0]
     if(objForm.elements['field1'].checked){
          objForm.elements['field1'].focus();
     }
}
//-->
</SCRIPT></HEAD>
 <BODY>
  <FORM METHOD="post" ID="form1" NAME="form1">
   <P>
    <FONT FACE="Arial,Helvetica,Monaco"><FONT SIZE="2"><FONT COLOR="BLACK"><!-- $MVD$:spaceretainer() --></FONT></FONT></FONT>&nbsp;</P>
   <P>
    <FONT FACE="Arial,Helvetica,Monaco"><FONT SIZE="2"><FONT COLOR="BLACK">Name:&nbsp;</FONT></FONT></FONT></P>
   <P>
    <INPUT TYPE=TEXT NAME="color 1" SIZE="25" MAXLENGTH="256" ID="text1" ONKEYUP="getElementById('text2').value=this.value;"></P>
   <P>
    <INPUT TYPE=TEXT NAME="textarea1" VALUE="This is the sample text." SIZE="100" MAXLENGTH="10" ID="text2" STYLE="" ONFOCUS="setDisabled(this)"> <INPUT TYPE=RADIO NAME="field1" ONCLICK="setStyle()">
    Disable textarea.
   </FORM>
 </BODY>
</HTMLStart Free Trial
 
Loading Advertisement...
 
[+][-]05.01.2008 at 05:58AM PDT, ID: 21478113

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Hypertext Markup Language (HTML), Scripting Languages
Tags: javascript html script
Sign Up Now!
Solution Provided By: HonorGod
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.01.2008 at 07:58PM PDT, ID: 21484320

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 04:51AM PDT, ID: 21485871

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628