473,732 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accesing object properties programatically

1 New Member
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.substrin g(4, 5);
var myS = a.name.substrin g(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(butt onGroup){
for (i=0; i < buttonGroup.len gth; i++) {
if (buttonGroup[i].checked == true) {
return i;
}
}
}

<input type="radio" name="optD1S1" id="optD1S1" value="D1S1-1" onClick="Disabl eOther(this)" />
<input type="radio" name="optD1S1" id="optD1S1" value="D1S1-2" onClick="Disabl eOther(this)" />
<input type="radio" name="optD2S1" id="optD2S1" value="D2S1-1" onClick="Disabl eOther(this)" />
<input type="radio" name="optD2S1" id="optD2S1" value="D2S1-2" onClick="Disabl eOther(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 1232
gits
5,390 Recognized Expert Moderator Expert
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
1155
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 documenten\BARCO\Eindwerk\Project Files\thuis\13december\Aviewerversie02\FileLoad.cs(417): The type or namespace name 'h' could not be found (are you missing a using directive or an assembly reference?)
5
9860
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 file). FileInfo and FileSystemInfo classes expose only the standard properties (create time, mod time etc..). Any pointers would be greatly appreciated. Thanks, Ram Thiru
7
11950
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 "DirectoryEntry" objects within the path that I specify (either using the DirectoryEnrtry.Children or using the DirectorySearcher class) and all started well and dandy! Now the problem; some of the properties of the DirectoryEntry objects being...
13
4144
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 am using FireFox 1.5.0.1 I am looking for something like myImg.container. Can someone help me ? Thanks in advance
2
2082
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 "WebNotification". In the WebSite "App1" we create an instance of "WebNotification", but when this class tries to access some Session variables it generates the following error: Session state can only be used when enableSessionState is set to...
4
1328
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
1641
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 code I m able to download files from that url using "DefaultCredentials" but i want to use password and username to access resources if tht url contains. & if for tht specific url if user enters wrong username & password so tht he must not...
16
4172
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 therefore being able to modify its properties?
6
1226
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 = {}; events.flatUsers.Clone = "I'm the Clone property"; events.flatUsers.Edit = "I'm the Edit property";
0
8946
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...
1
9235
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
9181
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
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...
1
6735
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
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
4809
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3261
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

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.