473,386 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Addressing form variables with the same form in separate forms (IE vs Firefox)

In IE it is simple to address form fields with the same name in multiple forms, such as:

Expand|Select|Wrap|Line Numbers
  1. document.firstform.mode.value='open';
  2. document.secondform.mode.value='new';
  3. etc
But in Firefox I am forced to use getElementById, as in:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById['mode'].value='open';
But this doesn't include a form reference and so only changes the first use of mode.

Is there a FireFox friendly way to address similar named elements in different forms, without having to use mode1, mode2 etc.?
May 23 '07 #1
2 1301
Logician
210 100+
In IE it is simple to address form fields with the same name in multiple forms, such as:

Expand|Select|Wrap|Line Numbers
  1. document.firstform.mode.value='open';
  2. document.secondform.mode.value='new';
  3. etc
That is not proper syntax, I.E. just accepts it.

There is no issue with different forms having elements of the same name.

If a form and its elements have name attributes, this syntax is universal:
Expand|Select|Wrap|Line Numbers
  1. document.forms.formName.elementName
If a form and its elements have id attributes, use
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(elementId);
All id attributes within a document must be unique.

Do not pass a name attribute to document.getElementById - that's something else that shouldn't work in I.E.
May 23 '07 #2
pbmods
5,821 Expert 4TB
You can also use getElementsByName.
May 24 '07 #3

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

Similar topics

13
by: genetic.error | last post by:
I'm moving from Vb6 to VB.Net. I have a feeling this has come up before... The VS.Net MSDN file seems to state that the following should work: Form1.Show Form1.Visible = True Form1.Hide...
0
by: John Wood | last post by:
I have an ASP script in which I want to control the screen as two frames If I use a FRAMESET this works fine but the frame geometry is fixed the script uses POST and hidden fields to transfer the...
2
by: news.microsoft.com | last post by:
I have a form that shows my name on the top half and my address on the bottom half. Is it possible to divide this form into two separate child forms (inside MDI form)? Thanks.
1
by: iMedia User | last post by:
I have a site where I want to use the Web form validators in two separate forms on a single page. One form allows existing users to log in while the second one allows new users to register. The...
8
by: Leszek | last post by:
Hi. I have two forms each in different file user need to fill both one after another. Is it possible to display variables from both forms at the end? does $_POST contains variables from...
4
by: raj_genius | last post by:
I hav two queries, whc are as follows: FIRSTLY: is it possible to access the controls(by name) of a parent form(MDI) from its child forms??if yes then how??plzz provide a coded example in VB if...
3
by: misra.manisha | last post by:
Hi, I am using frames (I know that its not a good practice, but I have to). Each of these frames have separate form variables, all of which are needed in the parent frame. Now, the problem is...
2
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. ...
3
by: BASSPU03 | last post by:
(I'm using Access 2003 on a Windows XP O/S.) I have four tables that are related in the following order: tblFiscalYear > tblBulkObligations > tblProjects > tblResources These are their...
2
by: gumdealer328 | last post by:
I have multiple forms and in the 2nd form i access some variables and get there values which are added up by the function in the cost class. when i put "Dim TotalCost as New Cost" does that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.