devxlogo

Using Form Elements in DHTML

Using Form Elements in DHTML

Question:

I am having a problem accessing the form elements that are inside a DIV tag. It works in Internet Explorer but not in Netscape. The alert comes in both the browsers, but the next statement does not work in Netscape. Here is my code:

Document Title
This is in the div tag
Month Year

Answer:

Try placing the FORM tag outside of the DIV, so that it is at the root level. While IE is smart enough to understand that interior FORMs should be treated in the same manner as exterior FORMs, a FORM is principally an indicator to the browser that the content contained therein should be compiled as part of the same entity for posting purposes.

Also, earlier forms in Netscape had confirmed problems with tables, especially tables that were in turn contained in other objects. This may be impacting your situation somewhat. Also, note that options require values in addition to text content (). If the parser has problems resolving situations like this, it may not end up creating the form control instances.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist