Solved

onClick check all checkboxes

Posted on 1998-05-14
1
290 Views
Last Modified: 2008-02-01
How do I onclick of button, check all checkboxes on a form. (FYI form Name = sched)?
0
Comment
Question by:capoeira
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 28

Accepted Solution

by:
sybe earned 50 total points
ID: 1278061
The code below works in NS3, haven't checked it with other browsers. You can't do it with a submit button, because this will submit the form. But in stead of the text between the <a href=...> and </a> you can use an image which looks like a button.


You can build in a check if a form element is a checkbox or not.
something like:
if (document.form1.element[i].type = "checkbox") {

}

============

<script>
function CheckThem() {
      i = 0;
      while (i < document.form1.length) {
            document.form1.elements[i].checked = true;
            i = i + 1
      }
}

</script>

<form name="form1">
<input type="checkbox" name="a">
<input type="checkbox" name="b">
<input type="checkbox" name="c">
<input type="checkbox" name="d">
<input type="checkbox" name="e">
<input type="checkbox" name="f">
<input type="checkbox" name="g">
<input type="checkbox" name="h">
<input type="checkbox" name="i">
<P>
<a href="Javascript:CheckThem()">Check All Boxes</a>

</form>

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

736 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question