Set textarea row when checkbox checked

Hi all,
I was wondering if you someone can help me with …
I have a checkbox and when the it’s checked I want to increase the row of the textarea

         for(i=0; i < chkBoxes.length; i++) {
           chkBoxes[i].onclick=function() 

{

document.getElementById(‘addnote’).rows =4; // this only increase the textarea of the first row. If I have more than row , it won’t work
}

Thank you.

The following script adds or subtracts rows, depending on whether the box is checked or not.

[HIGHLIGHT=“”]
<!doctype HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>

<head>

<meta http-equiv=“Content-Type” content=“text/html; charset=windows-1252”>
<title>Add Rows to Textarea</title>
<script type=“text/javascript”>
<!–
// default number of rows in textarea
var tAreaRows=2; // global
//
// on click handler for checkboxes
function moreRows()
{// if object has been checked add row, else remove row
tAreaRows=(this.checked==true)? ++tAreaRows : --tAreaRows;
// ref to textarea
var txtAreaObj=document.getElementById(“addnote”);
// apply new number off rows
txtAreaObj.rows=tAreaRows;
// change msg in textarea
txtAreaObj.value="Rows= "+tAreaRows;
}
//
function assignHandler()
{// shortcut to form
var ff=document.myForm;
// assign onclick handler to each checkbox on page load
for(var i=0;i<ff.chkBoxes.length;i++)
{ ff.chkBoxes[i].onclick=moreRows; }
}
//
window.onload=assignHandler;

//–>
</script>
<style type=“text/css”>
<!–
#myForm p { margin:10px; }
–>
</style>
</head>

<body>

<!-- need additional attributes here –>
<form name=“myForm” id=“myForm”>
<p><input type=“checkbox” name=“chkBoxes” value=“ON”></p>
<p><input type=“checkbox” name=“chkBoxes” value=“ON”></p>
<p><input type=“checkbox” name=“chkBoxes” value=“ON”></p>
<p><input type=“checkbox” name=“chkBoxes” value=“ON”></p>
<p><input type=“checkbox” name=“chkBoxes” value=“ON”></p>
<p><br>
<textarea id=“addnote” name=“addnote” cols=“20” rows=“2”>Rows= 2</textarea>
</p>
</form>
<!-- end myForm –>

</body>

</html>

Thank you very much for taking your time to answer my question AllanP and webgypsy.

Sorry, but
var txtAreaObj=document.getElementById(“addnote”); -This line works if I have only one row but I have multiple rows , it won’t work.
Let say checkbox(n) is checked so (textarea(n) row should be re-sized.

checkbox textarea(addnote)
1 1
2 2
3 3
… n n

Yes if a checkbox is checked then I want to set the textarea.row = 4;

I have a checkbox for each textarea

<td><input type=checkbox name=chk<%=iCount%> onclick=“getNextSibling(this)” value=“<%=objRSNo(“id”) %>” /></td>

   &lt;td class="tdHidden"&gt; &lt;textarea  name=addComment&lt;%=iCount%&gt; rows="1" id="addComment"&gt;&lt;/textarea&gt; &lt;/td&gt;

Thank you so much , this what I was looking for.
It works !!!