Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

Adding checkboxes

Javascript coding ..

Moderators: macek, egami, gesf

Adding checkboxes

Postby gregd » Tue May 15, 2012 10:07 am

OK, I am a newbe

Say I have a bunch of checkboxes
Code: Select all
 <tr>
   <td colspan='2' class='normal'><input type='checkbox' name='formCheck1'>Check If this Form is Correct</td>
 </tr>
 <tr>
   <td colspan='2' class='normal'><input type='checkbox' name='formCheck2'>Check If this Form is Correct</td>
 </tr>
  <tr>
   <td colspan='2' class='normal'><input type='checkbox' name='formCheck3'>Check If this Form is Correct</td>
 </tr>
  <tr>
   <td colspan='2' class='normal'><input type='checkbox' name='formCheck4'>Check If this Form is Correct</td>
 </tr>




And in a function I want to add the number of checkboxes checked.

I am looking for some kind of hack.
I would rather not have to do this over and over
Code: Select all
if(!formname.formCheck1.checked)
{
}



I have tried
Code: Select all
x = x + ormname.formCheck1.checked

Hoping that a true might work as a 1.

Does anyone know an easy way for this to be done?

thanks
gregd
New php-forum User
New php-forum User
 
Posts: 1
Joined: Fri Apr 27, 2012 5:55 pm

Return to JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.