Netscape v. IE DOM - lonesome forms above frameset

  • Thread starter Christopher C. Stacy
  • Start date
C

Christopher C. Stacy

I have a page that looks like:

<html>
<head><blah></head>
<form id="me">
<input id="foo" type="hidden"...>
<frameset> <frame id="here" ...>
</form>
....</html>

The "here" frame's page is trying to access the above form.

In IE, this can be done as:
top.document.forms[0].foo.value

But under Netscape (7.1), it seems like the FORM is not being
processed at all. I tried all kinds of paths to find it.
On the main page, I wrote a little onload function for the FRAMESET,
and it reports that the top.document.forms.length => 0.

Maybe it's not legal to have that FORM there, outside of any BODY,
and maybe Netscape is just ignoring it entirely. Or maybe I'm just
confused about how I might reference it.

I didn't design this page, but I can change it in any way needed.

Suggestions?
 
M

Martin Honnen

Christopher said:
I have a page that looks like:

<html>
<head><blah></head>
<form id="me">
<input id="foo" type="hidden"...>
<frameset> <frame id="here" ...>
</form>
...</html>
But under Netscape (7.1), it seems like the FORM is not being
processed at all.

Your HTML document should either have a <body> after the <head> and in
that <body> you can have your <form> (and maybe an <iframe> if needed)
or it should have a <frameset> following the <head>. HTML 4 is defined at
http://www.w3.org/TR/html4/
what you have above is not following those rules.
 
C

Christopher C. Stacy

Martin> Your HTML document should either have a <body> [...]

I didn't design this mess, but what the author is trying to do is to
work with a sequence of three pages. The first one, not shown here,
posts a bunch of variables to the second page. My example above
is the second page, which needs to be able to receive the INPUT.
The third page is in the FRAMESET, and it wants to read out the
variables from that second page using Javascript.

This hack works under IE, because IE allows the FORM as a toplevel
element in the HTML. You say this is not legal HTML, and without
checking carefully, I think you're probably right. My original
message was already suggesting that perhaps that's why Netscape
did not seem to be rendering the FORM in the document object.

I also asked an implied question: Does Netscape 7.1 implement
the DOM that I think it does, where top.document has a forms array
(with no funny layers business in there or anything like that).
 
T

Thomas 'PointedEars' Lahn

Martin said:
Your HTML document should either have a <body> after the <head> and in
that <body> you can have your <form> (and maybe an <iframe> if needed)

Both the start and the end tag of the "body" element are optional
in HTML, so this should not be a problem regarding DOM scripting
and it is not in Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2)
Gecko/20040630 Firefox/0.8.0+, so I doubt it is in Netscape 7.1.
or it should have a <frameset> following the <head>. HTML 4 is
defined at
http://www.w3.org/TR/html4/
what you have above is not following those rules.

True.

And the "blah" element is undefined in HTML and could cause a problem
as well but I think it was only a replacement for posting. However,
that replaced code may cause a problem as well. It appears best not
to post changed code but code with reasonable marked omissions or the
full unchanged code, if too much for a newsgroup posting to be linked
with a URL of a public Web site.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top