I have a need to fill in a textarea with a specified value only if a checkbox is checked. If it is not checked, then nothing will happen. I have been trying to write it myself and with little result. Here is what I have so far:
<script language="javascript">
<!--
function checkCheckBox(f){
if (document.formname.s2q1test.value == true ){
var obj_text = document.FrontPage_Form1.s2q1comments
obj_text.value = "n/a"
}
}
-->
</script>
AND THE HTML...
<tr><td>
<input type="checkbox" name="s2q1test" id="s2q1test" value=http://www.webdeveloper.com/forum/archive/index.php/"0" tabindex="1" onclick="checkCheckBox(this)">Does not apply to my job
</td><td>
<textarea rows="4" name="s2q1comments" id="s2q1comments" cols="40" tabindex="2"></textarea>
</td></tr>
Any help would be appreciated...
<script language="javascript">
<!--
function checkCheckBox(f){
if (document.formname.s2q1test.value == true ){
var obj_text = document.FrontPage_Form1.s2q1comments
obj_text.value = "n/a"
}
}
-->
</script>
AND THE HTML...
<tr><td>
<input type="checkbox" name="s2q1test" id="s2q1test" value=http://www.webdeveloper.com/forum/archive/index.php/"0" tabindex="1" onclick="checkCheckBox(this)">Does not apply to my job
</td><td>
<textarea rows="4" name="s2q1comments" id="s2q1comments" cols="40" tabindex="2"></textarea>
</td></tr>
Any help would be appreciated...