djbuddhi Posted June 12, 2008 Share Posted June 12, 2008 i need a javascript to check whether this at least one check box is clicked or not <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>-- UNION ASSURANCE </title> <link href="bud.css" rel="stylesheet" type="text/css"> <script language="javascript"> var noOfSubmits = 0; function CheckAll() { count = document.form1.elements.length; for (i=0; i < count; i++) { if(document.form1.elements.checked == 1) {document.form1.elements.checked = 0; } else {document.form1.elements.checked = 1;} } } function initForm() { noOfSubmits = 0; } function validate_form() { if(document.getElementsByName("items[]").checked) { alert("checked"); } else { alert("unchecked"); } } function formValid_place() { var agree=confirm("Are you sure you wish to continue?"); if (agree) { // count_check = document.form1.elements.length; //for (i=0; i<document.form1.d.length; i++){ //if (document.form1.d.checked==true) //alert("Checkbox at index "+i+" is checked!") //} //return false; //} } noOfSubmits++; if(noOfSubmits>1) { alert("Submission already done. Please wait...."); return false; } document.form1.submit(); }else{ return false; } return (true); } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <body onLoad="initForm();"> <br><br><br><br> <form name="form1" method="post" action="" onSubmit="return formValid_place()"> <br><div align="center"> <table width="88%" align="center" class="adminlist"> <tr> <th height="25" colspan="2"> <div align="left">Company Information</div></th> </tr> <tr class="row0"> <td width="30%" align="right"> <em>Company Name</em> : </td> <td width="70%">xcxczxc</td> </tr> <tr class="row1"> <td align="right"><em>Address 1 </em>: </td> <td width="70%">No-90 Galle Road</td> </tr> <tr class="row0"> <td align="right"><em>Address 2 : </em></td> <td>Panadura</td> </tr> <tr class="row1"> <td align="right"><em>City : </em></td> <td width="70%">Panadura</td> </tr> </table></div> <br><br><br><br><div align="center"> <table width="91%" align="center" cellpadding="0" cellspacing="0" class="adminlist"> <tr> <th height="25" colspan="6"> <div align="left">Mark Payments for Participating Employees </div></th> <th height="25" colspan="2"><input name="btn" type="button" onclick="CheckAll()" value="Check All"> </th> </tr> <tr class="row1"> <td width="13%" height="27" nowrap="nowrap" ><strong><DIV align="right">Policy Number</div> </strong></td> <td width="17%" nowrap="nowrap" ><strong>Employee Name</strong></td> <td width="21%" nowrap="nowrap" ><strong>Department</strong></td> <td width="11%" nowrap="nowrap" ><strong>Policy State</strong></td> <td width="8%" nowrap="nowrap" ><div align="right"><strong> Premium Amount</strong></div></td> <td width="8%" nowrap="nowrap" ><strong>No of Days From Last Payment</strong></td> <td width="14%" nowrap="nowrap" ><strong>Last Payment</strong></td> <td width="8%" nowrap="nowrap" ><strong>Payment</strong></td> </tr> <tr class="row1" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 45353</div></td> <td nowrap="nowrap">Mr vxcv c</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 185.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d1" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="45353" /></div></td> </tr> <tr class="row0" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 64563</div></td> <td nowrap="nowrap">Mr Mr.S.De Wijesekera</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 465.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d2" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="64563" /></div></td> </tr> <tr class="row1" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 44444</div></td> <td nowrap="nowrap">Mr Mr.S.De Mr.S.De Silva Wijesekera</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 465.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d3" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="44444" /></div></td> </tr> <tr class="row0" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 32342</div></td> <td nowrap="nowrap">Mr Mr. S. Gunawardena</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 370.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d4" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="32342" /></div></td> </tr> <tr class="row1" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 53453</div></td> <td nowrap="nowrap">Mr Mr. S. Gunawardena</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 375.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d5" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="53453" /></div></td> </tr> <tr class="row0" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 03423</div></td> <td nowrap="nowrap">Mr Mr. S. Gunawardena</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 560.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d6" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="3423" /></div></td> </tr> <tr class="row1" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 00003</div></td> <td nowrap="nowrap">Mr xcv cxvx</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 465.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d7" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="3" /></div></td> </tr> <tr class="row0" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 02142</div></td> <td nowrap="nowrap">Mr p.n.r ranasinhe</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 945.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d8" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="2142" /></div></td> </tr> <tr class="row1" onmouseout="javascript:style.backgroundColor=''"onmouseover="javascript:style.backgroundColor='#F6F9ED'"> <td nowrap="nowrap"><div align="right"> 56456</div></td> <td nowrap="nowrap">Mrs zzx ZZX</td> <td nowrap="nowrap"></td> <td nowrap="nowrap"><font color="#333333">Active</b></font></font></td> <td nowrap="nowrap"><div align="right"> 2,545.00</div></td> <td nowrap="nowrap"><div align="right">0</div></td> <td nowrap="nowrap">12 / 06 / 2008</td> <td nowrap="nowrap"><div align="center"><input type="checkbox" name="d9" class="detailedViewTextBoxsmall" onFocus="this.className='detailedViewTextBoxOnsmall'" onBlur="this.className='detailedViewTextBoxsmall'" value="56456" /></div></td> </tr> <TR class="row0"> <td ></td> <td ></td> <td ></td> <td ><b>Total (Rs.) :</b></td> <td ><div align="right"><b>6,375.00</b></div></td> <td > </td> <td ></td> <td ></td> </TR> </table> </div> <br> </p> <br> <div align="center"> <input type="button" name="Submit32" value="Back" style="width:70px; height:22px " class="mainoption" onClick="location.replace('add_mark_payments.php');"> <input type="submit" name="mark" id="mark" value="Mark" style="width:70px; height:22px " class="mainoption" > </div></form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/109830-how-to-check-this-dynamic-check-box-is-clicked-or-not/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.