472,363 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Accesing object properties programatically

I have an event where attendants can register for online. This is 2 day event. I want to be able to disable the same lab on day2 when it has been selected on day1 (so attendants don't select the same lab on two different days).
This is the function I am using...

[HTML]function DisableOther(a){
var myD = a.name.substring(4, 5);
var myS = a.name.substring(6, 7);
var othD;
if (myD == 1){
othD = '2';
} else {
othD = '1';
}
var b = eval("document.frm01." + a.name);
var c = findButton(b);
eval("document.frm01.optD" + othD + "S" + myS + "[" + c + "].disabled = true");
if (c == 0){
eval("document.frm01.optD" + othD + "S" + myS + "[" + (c + 1) + "].disabled = false");
} else {
eval("document.frm01.optD" + othD + "S" + myS + "[" + (c - 1) + "].disabled = false");
}
}
function findButton(buttonGroup){
for (i=0; i < buttonGroup.length; i++) {
if (buttonGroup[i].checked == true) {
return i;
}
}
}

<input type="radio" name="optD1S1" id="optD1S1" value="D1S1-1" onClick="DisableOther(this)" />
<input type="radio" name="optD1S1" id="optD1S1" value="D1S1-2" onClick="DisableOther(this)" />
<input type="radio" name="optD2S1" id="optD2S1" value="D2S1-1" onClick="DisableOther(this)" />
<input type="radio" name="optD2S1" id="optD2S1" value="D2S1-2" onClick="DisableOther(this)" />[/HTML]

I know I shouldn't use eval but I don't know how to access the properties of the radio button group.
The above code is working on IE but not working on FF, any ideas??
Thanks...
Jan 26 '08 #1
1 1181
gits
5,390 Expert Mod 4TB
hi ...

yes :) ... you shouldn't (and needn't) use eval ... have a look at the following example:

Expand|Select|Wrap|Line Numbers
  1. // we have a part of your id
  2. var id = 'optD1S';
  3.  
  4. // now we make the correct id (optD1S1)
  5. var node_id = id + 1;
  6.  
  7. // refer to the node with node_id
  8. var node = document.getElementById(node_id);
  9.  
  10. // setting the disabled attrib to disabled
  11. node.setAttribute('disabled', 'disabled');
  12.  
  13. // remove the attrib
  14. node.removeAttribute('disabled');
  15.  
kind regards
Jan 28 '08 #2

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

Similar topics

3
by: Jeroen Ceuppens | last post by:
Hi, I have a problem accesing h, when i want to do h.Run() after the if else structure, i get the following error: (see below for code) C:\Documents and Settings\Eindwerk\Mijn...
5
by: Ram [MSFT] | last post by:
Hi All, I'm trying to programatically (using c#) read the file properties (Title, Summary, Author, Comments etc.... The stuff that shows up on the Summary tab when you see the properties of a...
7
by: Martin Robins | last post by:
I am currently looking to be able to read information from Active Directory into a data warehouse using a C# solution. I have been able to access the active directory, and I have been able to return...
13
by: Fernando Deutsch | last post by:
I have an html page with an iframe on it. Inside the iframe there is an img element. I am looking how to reference the iframe from the img element contained on it and cannot find a way to do it. I...
2
by: ras26 | last post by:
I have a WebSite "App1" which has an external assembly "Lib1". Inside this external assembly we have developed some classes that derive from "System.Web.UI.Page". One of these pages is called...
4
by: sracherla | last post by:
Hello Guys, Please look at the code sample below. Class Customer { private string _ID; private string _Name; public string ID
1
by: gujarsachin2001 | last post by:
hello friends i m connecting to http or https url programatically through console application using follwoing methods of credentilas but if there is username & password for that url through this...
16
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and...
6
by: =?ISO-8859-1?Q?Ignacio_Burgue=F1o?= | last post by:
Hi everyone. I'm dealing with some javascript code which uses eval to access properties of an object. For instance, I have the following: var events = {}; events.flatUsers = {};...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
1
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
0
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...

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.