How can I access the elements of a form defined in a Frameset page in NS6. (works in IE and NS4x)
Apr 6th, 2008 18:54
ha mo, chandra sekhar, sven vahar,
Use "top" property to start counting from top browser window which
contains frameset and move down to whatever frame you need. Examples:
x = top.framename.document.getElementsByTagName('body');
x = top.framename.document.forms.elementname.value;
So if you have frame named "guestbook" and it contains form
named "comments" and textarea named "entry" then you can access its
x = top.guestbook.comments.entry.value;
This is author (Chandra Sekhar) of the question again...
I think my question is interepreted in other way. I will try to explain
the question with example. However I got the resolution.
Q : When I have a Form in the frames page, Form will not be detected in
case of NS6.X. The following is the sample code.
<META HTTP-EQUIV="Expires" CONTENT="0">
<TITLE> Sample page </TITLE>
<Form Method=Post id=MyForm name=MyForm >
<INPUT NAME =hdntxt1 id =hdntxt1 type=Hidden >
<INPUT NAME = hdntxt2 id =hdntxt2 type=Hidden >
<FRAME SRC="sample.asp" NAME="frame1" MARGINWIDTH=0
MARGINHEIGHT=0 NORESIZE SCROLLING=no>
<FRAME SRC="Blank.html" NAME="frame2" FRAMEBORDER=0
The form that contains hidden text boxes is not accessible in the
clientside script in case of NS6x.
Ans: According to standards, this is illegal HTML. However this is
supporeted in NS4.x and IE browsers. The workaround for this is as
1. Define another frame with "0%" using cols/rows property of the
frameset tag. Move the form that contains the hidden text boxes to this
2. Define a new Frame onload function if initialization is required for
any one of these hidden text boxes. This might be required for ASP
3. Access these form elements using "top" property.