473,804 Members | 4,217 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I change the name of a HTML checkbox using javascript

1 New Member
When the page is first accessed, certain HTML elements are dynamically created. The checkboxes all have the name "chkBox". There is a special "checkAll" checkbox which when checked or unchecked, does the same operation on all the "chkBox" elements. It gets them by calling document.getEle mentsByName("ch kBox") and then modifies their status. Now I have a requirement to bypass some of the checkboxes. Being too lazy to maintain a separate bit array that specifies whether or not a checkbox is to be bypasses, I want to simply change their names at runtime so that the document.getEle mentsByName("ch kBox") doesn't select them. I tried the .name="blah" on the checkbox object but did not work. I'm using IE 6.
Please explain.
Oct 3 '07 #1
1 2484
gits
5,390 Recognized Expert Moderator Expert
hi ...

IE doesn't allow you to set the name-attribute at runtime. have a look here ... but you may set a style-class that you may use to identify the boxes or simply use a custom attribute for that. custom attributes make your html invalid but i would prefer that way because of the right semantic use of them ... instead you may misuse the class attribute for that ...

kind regards
Oct 3 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
7124
by: Ellie100 | last post by:
Hi all I'm a first-time poster and would appreciate some help with a problem I'm having. I have an HTML form (UPD_BUDG) which includes 10 checkboxes, all with the same name (Apply_Phasing_CB) but different values. On its own (i.e. before I add any JS) the form works fine. I need to add an onSubmit function which counts how many of the boxes are checked. Here is the script I have used:
3
26970
by: Matt | last post by:
I want to change the label on the fly (when the user click the checkbox), but my attempt InputForm.lataLbl.value = "LATA * "; didn't work. Here's my code, any ideas? thanks !!! <html> <script type="text/javascript"> function ig_onchange()
3
26503
by: Noozer | last post by:
I have several tags on a webpage of the same class. If the user clicks a specific checkbox I'd like to be able to alter the display property of the class, affecting all objects of that class. This is an intranet application so we know that javascript will be enabled and the browser will be IE. How can I affect all the members of this class? Is there a way I can toggle the DISPLAY property of a class so all the elements using that class...
3
4493
by: Marc Castrechini | last post by:
I have a page that changes an <ASP:Checkbox value based on a user entered value in a textboxm using client side Javascript. After my submit is fired the value for the chkMyCB.checked does not get the latest value of the checkbox. Does this sound like a posibility and if so how can I force the server to get the new value from the page? TIA,
10
3597
by: apparker | last post by:
I'm creating a new GUI for a program and it is for a medical exam. There are so many different things to ask someone during a history it wastes too much space to make checkboxes for everything so I had an idea: Can I simply create a list of conditions and when the doctor clicks them, they turn red? And clicking them again would make them default again? This would really make the exam better since the doctor could quickly glance at a...
3
2603
by: printline | last post by:
Hi' I have a little problem with the onclick event. I have an image that i use as a button. When i click this image/button some text appears and a new image/button also appears. when i then click the new image/button the text should disapper again. I have gotten so far as to getting the text to appear, but can't quite figure out how to make it disappear again, with the new button. Please help, thank You. Here is my code:
2
13147
by: nitindutt2005 | last post by:
Hi I have a html file as below. ==================================================================== <html> <head> <td style="background-color:rgb(170, 157, 244);"> <table border="0" cellpadding="5" cellspacing="2" width="95%">
6
1656
by: inamul | last post by:
Hi Guys, I am am trying to validate multiple check box. It works fine when checkbox name is like chkSectionInterested but when i add to the name chkSectionInterested, then i can validate any more. I need to keep so that i can save data using php collected from this page. If i remove from checkbox name then php only gets last selected value from the check box please help. I have been looking for two days but nothin seems to work. ...
7
4876
by: moksha | last post by:
Hi, I am new to javascript and i am facing a problem in coding. plz help me out. I am using javascript for dynamically creating a table row which contains text boxes and radio buttons and check box. I am adding two radio buttons once for a row.Now my problem is the radio buttons in all the rows that added dynamically are behaving as same group i.e when i am selecting a radio button in second row,radio button in first row...
0
9707
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10323
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5658
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.