having a problem with my jsp
hi
I am new to this forum. i am using struts in my jsp. the first time the jsp is displayed the checkbox is not checked., which by default is not checked.
The label CRA should only be displayed when the checbox is checked., and when again the checkbox is unchecked it should not be displayed.
I used javascript to do this but when the page is displayed for the first time the label is getting displayed which should not happen since the checkbox is unchecked, but the javascript function works fine when i again check and uncheck the checkbox. so the problem is only when the page gets displayed for the first time.
can anyone help me find a solution for this
code:
<script language="javascript">
function hide (section) {
elem = document.getElementById(section);
if (elem.style.display=="") {
elem.style.display="none";
}
}
function show (section) {
elem = document.getElementById(section);
if (elem.style.display=="none") {
elem.style.display="";
}
}
function toggleCRA(obj) {
if (obj.checked == false) {
hide("cra_Label_0_row");
}
else {
if (obj.checked == true)
{
show("cra_Label_0_row");
}
}
}
</script>
<html:form>
<table>
<tr id="cra_check_0_row">
<td class="Data">Will proceeds go to different address </td>
<td class="Example">
<html:checkbox property="diffAdd" styleId="cra_check_0" onClick="toggleCRA(this)"/>
</td>
</tr>
<tr id="cra_Label_0_row">
<td class="Data">CRA </td>
</tr>
</table>
</html:form>
thank you
makhtar

