juicy wrote:
I have create 4 check box, every check on the check box will append text in
textarea and any uncheck on check box will remove text in text area.
Please give some guide on how to control this.
Why Append/Remove ?
Seems simpler just recreating the whole "text" and setting the textarea
to it.
Warning Untested Sample Code --- Should not be used.
var output = "";
if (document.getEl ementById("chec kbox1id").check ed)
{
output = output + "Text1";
}
if (document.getEl ementById("chec kbox2id").check ed)
{
output = output + "Text2";
}
if (document.getEl ementById("chec kbox3id").check ed)
{
output = output + "Text3";
}
if (document.getEl ementById("chec kbox4id").check ed)
{
output = output + "Text4";
}
The variable "output" whould now be either "Text1Text2Text 3Text4" if
all checkboxes are checked, or "Text2Text4 " if only the 2nd and 4th are
checked ... and so on.
Set the value of the textarea to that and you're set, no need to
append/remove.