<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/> <meta content="utf-8" http-equiv="encoding"/> <script type="text/javascript" src="js/jquery-1.11.0.js"></script> <script type="text/javascript"> //Used to hide given number row $(document).ready(function() { $('#btnHide').click(function() { // if table has header(th), use this $('td:nth-child(3),th:nth-child(3)').hide(); }); }); </script> <script type="text/javascript"> //Used to make row editable or not $(document).ready(function () { $('.editbtn').click(function () { var currentTD = $(this).parents('tr').find('td'); if ($(this).html() == 'Edit') { $.each(currentTD, function () { $(this).prop('contenteditable', true) }); } else { $.each(currentTD, function () { $(this).prop('contenteditable', false) }); } $(this).html($(this).html() == 'Edit' ? 'Save' : 'Edit') }); }); </script> <script language="javascript" type="text/javascript"> //go to checkbox web page function btn_changeColumns_onClick() { window.location.href = "checkbox.html"; } </script> <script type="text/javascript"> // Returns an array with values of the selected (checked) checkboxes in "frm" $(document).ready(function () { function getSelectedChbox(frm) { // JavaScript & jQuery Course - http://coursesweb.net/javascript/ var selchbox = []; // array that will store the value of selected checkboxes var allLabels = []; // array to store value of all checkboxes, selected and not // gets all the input tags in frm, and their number var inpfields = frm.getElementsByTagName('input'); var lblFields = frm.getElementsByTagName('label'); var allLabelFields = frm.getElementsByTagName('label').innerHTML; var nr_inpfields = inpfields.length; // traverse the inpfields elements, and adds the value of selected (checked) checkbox in selchbox for(var i=0; i<nr_inpfields; i++) { if(inpfields[i].type == 'checkbox' && inpfields[i].checked == true) selchbox.push(lblFields[i].innerHTML); if(inpfields[i].type == 'checkbox') allLabels.push(lblFields[i].innerHTML); } alert(allLabels); return selchbox; } )} </script> </head> <body> <div class="form"> <p> <label>CheckboxList: Happy Friday <?php //this seems to work $theFrm = ($_POST ["myCheckboxForm"]); ?> getSelectedChbox($theFrm); //**compiler says this is a mis-spelled word </label> </p> </div> <table id="tableone" border="1"> <thead> <tr><th class="col1">Header 1</th><th class="col2">Header 2</th><th class="col3">Header 3</th><th class="col3">Header 4</th></tr> </thead> <tr class="del"> <td contenteditable="false">Row 0 Column 0</td> <td><button class="editbtn">Edit</button></td> <td contenteditable="false">Row 0 Column 1</td> <td contenteditable="false">Row 0 Column 2</td> </tr> <tr class="del"> <td contenteditable="false">Row 1 Column 0</td> <td><button class="editbtn">Edit</button></td> <td contenteditable="false">Row 1 Column 1</td> <td contenteditable="false">Row 1 Column 2</td> </tr> <tr class="del"> <td contenteditable="false">Row 2 Column 0</td> <td><button class="editbtn">Edit</button></td> <td contenteditable="false">Row 2 Column 1</td> <td contenteditable="false">Row 2 Column 2</td> </tr> <tr class="del"> <td contenteditable="false">Row 3 Column 0</td> <td><button class="editbtn">Edit</button></td> <td contenteditable="false">Row 3 Column 1</td> <td contenteditable="false">Row 3 Column 2</td> </tr> <tr class="del"> <td contenteditable="false">Row 4 Column 0</td> <td><button class="editbtn">Edit</button></td> <td contenteditable="false">Row 4 Column 1</td> <td contenteditable="false">Row 4 Column 2</td> </tr> <tr class="del"> <td contenteditable="false">Row 5 Column 0</td> <td><button class="editbtn">Edit</button></td> <td contenteditable="false">Row 5 Column 1</td> <td contenteditable="false">Row 5 Column 2</td> </tr> </table> <input id="btnHide" type="button" value="Hide Column 2"/> <input id="chgColumns" type="button" value="Change Columns Displayed" önclick="return btn_changeColumns_onClick()" /> </body> </html>
<label>CheckboxList: Happy Friday <?php <br mode="hold" /?> //this seems to work $theFrm = ($_POST ["myCheckboxForm"]); ?> <script> getSelectedChbox($theFrm); //**compiler says this is a mis-spelled word</script> </label>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)