• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Problem While using check boxes

 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your suggestion . But the actual problem is that i have a five check boxes where first check box name is "all" and other four check box name is subject names and their values are different.when i click the " all " checkbox the other subjectname check boxes will be checked or selected.so it works finer when i have more than one subject name.but when i have single subject name and when i click the" all " check box it throws an error message as undefined length.so i need help for check box having "all" check box and a single subjectname checkbox.





I am working on a application where i have five check boxes.First checkbox name is 'All' and name for other four checkboxes are 'Subjectname'. if i have a screen where all five checkboxes are displayed when i check in first check box i am getting no problems. but when i have a screen displaying only 'All' check box and single subjectname check box when i click check in 'All' checkbox i am getting a alert message as undefined length.how can i solve this problem. i am using html and javascript.

<code>

function Check(tt)
{
//alert(tt.value);
if(document.Form1.Check_ctr.checked==true){
for (i = 0; i < ; i++)
//alert(tt[i].value);
tt[i].checked = true ;
}else{

for (i = 0; i < y; i++)
tt[i].checked = false ;
}
}


<input type="checkbox" name="Check_ctr" value="yes"
onClick="Check(checkbox1)">
<input type="checkbox" name="checkbox1" value="Subjectname1">

<input type="checkbox" name="checkbox1" value="Subjectname2">

<input type="checkbox" name="checkbox1" value="Subjectname3">

<input type="checkbox" name="checkbox1" value="Subjectname4">

<input type="checkbox" name="checkbox1" value="Subjectname5">


</code>
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,

ex1: http://www.somacon.com/p117.php
ex2: http://www.plus2net.com/javascript_tutorial/checkbox-checkall.php

however, you will find more examples in search...

 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It has been asked many times on this forum: https://coderanch.com/t/116148/HTML-JavaScript/Select-All

Eric
 
I'm so happy! And I wish to make this tiny ad happy too:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic