473,471 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Change object values using an array

1 New Member
Greetings folks,

I have been trying for sometime now to figure out what I am sure is this very simply problem. I have been unscuessful in finding the answer though so if anyone can help I would definitely appreciate it.
Below is the code I am using, however it doesn't work for me and I know it is coming from the code inside the for loop as it works when I remove the code and write this manualy.

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" ><!--
  2.  
  3. var objname = new Array (3);
  4. var ifrmname = new Array (3);
  5.  
  6. objname[0] = document.getElementById("objframe1");
  7. objname[1] = document.getElementById("objframe2");
  8. objname[2] = document.getElementById("objframe3");
  9.  
  10. ifrmname[0] = "MAIN1";
  11. ifrmname[1] = "MAIN2";
  12. ifrmname[2] = "MAIN3";
  13.  
  14.     **function ViewIFRAME(framename, iframe_val) {
  15.  
  16.         for (var loop = 0; loop < objname.length; loop++){
  17.  
  18.             document.getElementByName(objname[loop]).style.display = "none";
  19.         }        
  20.  
  21.         document.getElementById(iframe_val).style.display = "";
  22.         document.getElementById(framename).style.display = "";
  23.     }
  24.  
  25.     function HideIFRAME(framename, iframe_val) {
  26.  
  27.         document.getElementById(iframe_val).style.display = "none";
  28.         document.getElementById('objframe').style.display = "none";
  29.  
  30.     }
  31. //-->
  32. </script>
The code is apart of a larger script I am writing which will allow users to togle between 3 built in IFRAMES within my page.

Thanks in advance,
Feb 3 '08 #1
1 1096
gits
5,390 Recognized Expert Moderator Expert
hi ...

the method is called getElementsByName and returns you a node list ... so why don't you use an id?

kind regards
Feb 4 '08 #2

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

Similar topics

11
by: Vani Murarka | last post by:
Hi Everyone, Does .NET offer any collection class which will give me objects last *accessed* such that I may build a least-recently-used cache that kills off objects that haven't been used for...
16
by: sneill | last post by:
How is it possible to take the value of a variable (in this case, MODE_CREATE, MODE_UPDATE, etc) and use that as an object property name? In the following example I want 'oIcon' object to have...
6
by: Luke | last post by:
Here is my emails to Danny Goodman (but probably he is very busy so he didn't answered it). First email(simple): Subject: JavaScript Arrays " We all know the array can act like HashMap, but is...
2
by: HairlipDog58 | last post by:
I have a component that implements a property called obj of type object. The intent is that a user can pass in any value or array of values and I will be able to retrieve the values. If the...
3
by: ozbear | last post by:
This is probably an obvious question. I know that pointer comparisons are only defined if the two pointers point somewhere "into" the storage allocated to the same object, or if they are NULL,...
3
by: spielmann | last post by:
Hello I want to change the scrollbar size of windows, How can I do that with vb.net I have find this in VB6 but how can we convert simply this code. thx
6
by: Pablo | last post by:
Hello, I am writing a windows application using C++ and BorlandBuilder 6 compiler. It is an event driven program and I need to create objects of some classes written by me. One of the classes...
2
by: assgar | last post by:
I am having problems getting the user selected form info to inserted into the mysql database. I am also rec eving an error: Warning: Variable passed to each() is not an array or object in ...
5
by: cty0000 | last post by:
I need to set several variable (can be different type) by sub function.. I don't know the count of variable and type, so i used object type and parameter list like below source.. After setData...
6
by: =?ISO-8859-1?Q?Norbert_P=FCrringer?= | last post by:
Hello, Imagine, that I've got a string variable containing a value of each possible value type (string, int32, double, ...). Now I want to convert the string to an object of the right type,...
0
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,...
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...
1
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
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,...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.