User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » javascript unchecking boxes Page [1]  
BigMan157
no u
103354 Posts
user info
edit post

ok, so i have 2 checkboxes, one named user[250] and the other user2[250]

i want to use javascript to uncheck the opposing box when the first one is checked

using an onclick that does document.form.user[250].checked=false won't work because of the square bracket rules for javascript

the square brackets need to stay there for something else i'm doing with them

is there a way to target the previous/next checkbox in a form using an onclick event and javascript easily?

and i would use radio buttons, but i want unchecked to be an option as well

1/14/2006 7:38:04 PM

State409b
Suspended
490 Posts
user info
edit post

document.getElementById("user[250]") or getElementByName("")

to actually answer your question, though-- this.nextChild unless there is formatting, in which case you will have to parse through the formatting until you get to the element you want

but you should really be thinking about why your naming conventions interfere with the reserved symbols of a language you intend to use with those conventions... not how to use it as an opportunity to create more work for yourself

[Edited on January 14, 2006 at 7:44 PM. Reason : ...]

1/14/2006 7:39:02 PM

BigMan157
no u
103354 Posts
user info
edit post

i need the brackets for php

1/14/2006 7:46:28 PM

State409b
Suspended
490 Posts
user info
edit post

I hope for your sake that you're not going to be the one responsible for maintaining this code, then

1/14/2006 7:53:21 PM

BigMan157
no u
103354 Posts
user info
edit post

i got it working

i shoulda been using the id parameter instead of the name parameter since the beginning >.<

and yeah, i feel sorry for whomever comes after me on this

course i'm the second person working on this and i basically learned as i went from the previous person's code

1/14/2006 8:04:15 PM

skokiaan
All American
26447 Posts
user info
edit post

learning DOMS are a biatch

1/15/2006 12:25:05 AM

 Message Boards » Tech Talk » javascript unchecking boxes Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.