crystalb24
Programmer
I'm trying to alter the appearence of my textarea fields. What I want is for a statement to be visible in the textarea until the user begins to type there.
Here is the code for the textarea field -
and the javascript I'm using to populate the textarea from the checkboxes listed below it -
What changes do I need to make?
~Crystal
Click here ( for a free iPod
Here is the code for the textarea field -
Code:
<input type='hidden' name='mission'>
<TEXTAREA ROWS="10" COLS="65" name="section2atextarea" class="style20"></textarea>
and the javascript I'm using to populate the textarea from the checkboxes listed below it -
Code:
<script language="JavaScript">
function updateTextarea(cb)
{
var taValue = document.formName.section2atextarea.value;
if(cb.checked)
{
if(taValue != "")
taValue += " ";
taValue += cb.value; //APPENDS checked value to textarea
}//end if
else //checkbox is not checked
{
if(taValue.indexOf(cb.value) > -1)
{
taValue = taValue.replace(cb.value, "");//removes UNchecked value once
}//end if
}//end else
taValue = taValue.replace(/\s+/g, " "); //reduces multiple spaces to single spaces
if(taValue.indexOf(" ") == 0)
taValue = taValue.substring(1);
document.formName.section2atextarea.value = taValue;
}//end function
</script>
What changes do I need to make?
~Crystal
Click here ( for a free iPod