Generating tag in textArea

[b]code[/b]

<form name="myForm">
<table>
  <tr>
    <td>blue<input type='radio' name='radioButton' value='[COLOR="Blue"]blue[/COLOR]'></td>
    <td>yellow<input type='radio' name='radioButton' value='[COLOR="Yellow"]yellow[/COLOR]'></td>
  </tr>
  <tr>
    <td>red<input type='radio' name='radioButton' value='[COLOR="Red"]red[/COLOR]'></td>
    <td>green<input type='radio' name='radioButton' value='[COLOR="Green"]green[/COLOR]'></td>
  </tr>
  <tr>
    <td>blue <input type='checkbox' name='checkbox' value='[COLOR="blue"]blue[/COLOR]'></td>
    <td>yellow <input type='checkbox' name='checkbox' value='[COLOR="Yellow"]yellow[/COLOR]'></td>
  </tr>
  <tr>
    <td>green <input type='checkbox' name='checkbox' value='[COLOR="green"]green[/COLOR]'></td>
    <td>red <input type='checkbox' name='checkbox' value='[COLOR="Red"]red[/COLOR]'></td>
  </tr>
</table>
<textArea name="myTextArea">myText</textArea>
</form>

I have a textArea like the above.

If a user clicks a radio button or check box which value is “blue” after he blocks the area of “myText”
The following tag is generated in the textArea.
“<color=‘blue’>myText</color>”

If a user clicks a radio button or check box which value is “yellow” after he blocks the area of “myText”
The following tag is generated in the textArea.
“<color=‘yellow’>myText</color>”

If a user clicks a radio button or check box which value is “red” after he blocks the area of “myText”
The following tag is generated in the textArea.
“<color=‘red’>myText</color>”

If a user clicks a radio button or check box which value is “green” after he blocks the area of “myText”
The following tag is generated in the textArea.
“<color=‘green’>myText</color>”

If it can make the generating tag I want, either radio button or check box will be O.K.

Can I make it with your help?

This will do it for you.

<title>Radio Button Fills Text Area</title>
<script type=“text/javascript”>
<!–
function process()
{ var i;
var formLength=document.myForm.radioButton.length;
// check which button was checked
for( i=0;i<formLength;i++)
{ if(document.myForm.radioButton[i].checked==true)
{
var stringTxt=“\”<color=‘“+document.myForm.radioButton[i].value+”’>myText</color>\“”;
document.myForm.myTextArea.value=stringTxt;
return true;
// ---------------
}
// if nothing selected
document.myForm.myTextArea.value=“No Selection”;
}
}
// ------------------
//–>
</script>
<style type=“text/css”>
<!–
#TT1 td { text-align:right; }
–>
</style>
</head>

<body>

<form name=“myForm”>
<table id=“TT1” border=“0” cellpadding=“0” cellspacing=“0” style=“border-collapse: collapse” width=“200”>
<tr>
<td>blue</td>
<td><input type=“radio” name=“radioButton” value=“blue”></td>
<td>yellow</td>
<td><input type=“radio” name=“radioButton” value=“yellow”></td>
</tr>
<tr>
<td>red</td>
<td><input type=“radio” name=“radioButton” value=“red”></td>
<td>green</td>
<td><input type=“radio” name=“radioButton” value=“green”></td>
</tr>
</table>
<p><input type=“button” value=“Get Code” onclick=“process()”></p>
<p><textarea name=“myTextArea” rows=“1” cols=“35”>myText</textarea> </p>
</form>

</body>

</html>