473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to create this simple little javascript function

Hello,
I have a list of checkboxes on a page... There is a certain list that
is numbered from 1 to n which i want to be able to "check all/none"
its easy to create this for all the checkboxes on the page but how
would i go about creating one that will only check those that are
numbered from 1 to n altho i dont know up to which number they go...
sometimes it can be from 1 to 5 or sometimes 1 to 99...
thanks :)

Oct 29 '06 #1
2 1067
ASM
Ken1 a écrit :
Hello,
I have a list of checkboxes on a page... There is a certain list that
is numbered from 1 to n which i want to be able to "check all/none"
its easy to create this for all the checkboxes on the page but how
would i go about creating one that will only check those that are
numbered from 1 to n altho i dont know up to which number they go...
sometimes it can be from 1 to 5 or sometimes 1 to 99...
thanks :)
anyway your checkboxes are named and names can't begin with a number
so their names could be this way :

<input type=checkbox name="ch_1" ...
<input type=checkbox name="ch_2" ...
...
<input type=checkbox name="ch_99" ...

you'll make a loop on elements of your form and will modify only
checkboxes of which names begin with 'ch_'
Oct 29 '06 #2

ASM wrote:
Ken1 a écrit :
Hello,
I have a list of checkboxes on a page... There is a certain list that
is numbered from 1 to n which i want to be able to "check all/none"
its easy to create this for all the checkboxes on the page but how
would i go about creating one that will only check those that are
numbered from 1 to n altho i dont know up to which number they go...
sometimes it can be from 1 to 5 or sometimes 1 to 99...
thanks :)

anyway your checkboxes are named and names can't begin with a number
so their names could be this way :

<input type=checkbox name="ch_1" ...
<input type=checkbox name="ch_2" ...
...
<input type=checkbox name="ch_99" ...

you'll make a loop on elements of your form and will modify only
checkboxes of which names begin with 'ch_'
alright thanks

Oct 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Mark | last post by:
I've been asked to convert a pay increase spreadsheet to an intranet page. So far I've developed a page that uses a combination of ASP and Javascript to retrieve all of the required information...
2
by: Evan | last post by:
Hey, I posted this yesterday, but no one had any ideas? C'mon now, I know this isn't that hard, i'm just a little new to javascript, and I can't quite figure this out. I searched and searched to...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
13
by: aum | last post by:
Hi, I'm a Python programmer, just starting to get into javascript. On reading some of the js guides, and not liking any of the OO usage patterns I saw, I've cooked up something which python...
1
by: MrZed | last post by:
I run into this problem, and I read many places that these is not solvable. I have one solution (workaround), not simple, a little trickier, limited, but possible and usable. My main problem...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.