How To Make Simple Select All In Check Box Using JavaScript
Submitted by alpha_luna on Thursday, July 30, 2015 - 16:51.
Good Day!!!
In this tutorial, we are going to make a Simple Select All In Check Box Using JavaScript. This is simple coding to have this project. And, this is a toggle function.Directions:
For JavaScript Code:
- <!-- Start of JavaScript -->
- <script language="JavaScript">
- function toggle(source)
- {
- checkboxes = document.getElementsByName('check_all');
- for(var i in checkboxes)
- checkboxes[i].checked = source.checked;
- }
- </script>
- <!--End of JavaScript -->
For HTML Code:
Full Source Code:
- <!DOCTYPE html>
- <html>
- <head>
- <!-- Start of JavaScript -->
- <script language="JavaScript">
- function toggle(source)
- {
- checkboxes = document.getElementsByName('check_all');
- for(var i in checkboxes)
- checkboxes[i].checked = source.checked;
- }
- </script>
- <!--End of JavaScript -->
- </head>
- <body>
- <table border="1" style="border:4px groove #CCC;" cellpadding="3" cellspacing="3">
- <tbody>
- <tr>
- </tr>
- <tr>
- </tr>
- <tr>
- </tr>
- <tr>
- </tr>
- <tr>
- </tr>
- <tr>
- </tr>
- </tbody>
- </table>
- </body>
- </html>
Add new comment
- 26 views