Thanks Joe, it works great, but upon unchecking the checkbox, it doesn't uncheck the rest of the checkboxes. Do you have any solutions(anyone out there has any solution to offer too)?
regards -- On Tue, 16 Apr 2002 13:32:16 Joe Latty wrote: >This Javascript works in IE and NN 6.02 > >function CheckAll(form){ > for (var i=0;i<form.elements.length;i++){ > var e = form.elements[i]; > if ((e.name == 'announcementID') && (e.type=='checkbox')) { > e.checked = true; > } > } >}//end of function > >-----Original Message----- >From: days [mailto:[EMAIL PROTECTED]] >Sent: Tuesday, 16 April 2002 12:49 PM >To: Struts Users Mailing List >Subject: (Urgent) Please help - validating checkboxes > >Hi I've got a "Select All" checkbox in my jsp that dynamically checks all >the checkboxes upon clicking on it. However I've got major problem trying to >retrieve the value for my checkboxes. Not only do I get a "Syntax error" >alert box, the checkboxes also doesn't get checked when I click on the >"Select All" checkbox. Obviously, the javascript is not working and I have >zero idea why. > >It appears as follows: > >/***********MY JAVASCRIPT******************/ ><SCRIPT language="javascript"> >function CheckAll(){ > var len; > len=document.announcementForm > [0].announcementID.length; > > if(len==null){ > document.announcementForm[0].announcementID.checked > = document.announcementForm[0].chkall.checked; > } > else{ > for (var i=0;i<len;i++){ > document.announcementForm[0].announcementID > [i].checked = true; > } > } >}//end of function ></SCRIPT> >/*************MY CODES*********************/ ><html:form action="/deleteNews.do" name="deleteNewsForm" >type="portlio.news.form.deleteNewsForm"> > ><input type="checkBox" name="chkall" value="ON"> >Select All > ><logic:iterate id="news" name="admin" property="newss" scope="session"> ><html:checkbox property="id" >value="<%=((portlio.news.entity.News)news).getNewsId()%>"/> > ></html:form> >/**************END********************/ > >PS:I've been working on it since yesterday but to no avail. Please >help...thanks a lot :) > >regards > > >See Dave Matthews Band live or win a signed guitar >http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201 >/splash.asp > >-- >To unsubscribe, e-mail: ><mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: ><mailto:[EMAIL PROTECTED]> > > >-- >To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> >For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > See Dave Matthews Band live or win a signed guitar http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>