About KJS::HTMLCollection::getNamedItems

Koos Vriezen koos.vriezen at xs4all.nl
Thu Aug 15 02:38:23 BST 2002


On Thu, 15 Aug 2002, David Faure wrote:

> On Thursday 15 August 2002 00:06, Koos Vriezen wrote:
> > Hi,
> >
> > Getting a route from www.routenet.nl doesn't work because they do
> > something like:
> >
> >   <form name="myname">
> >      <input name="myname" type="radio" value="xx">
> >      <input name="myname" type="radio" value="yy">
> >   </form>
> >
> > When the user submits, a script copies 'document.myname.myname.value' to a
> > hidden form element before posting.
> > KHTML returns a collection on 'document.myname'
> > and next throws a script error on 'document.myname.myname'.
>
> I'm very surprised. IE returns a collection when doing document.something
> and several elements are named that way, too.
> Maybe it has a special case for form names (and doesn't return the input
> elements when doing document.myname) ... but even then,
> document.myname.myname would still return a collection, that's 100% sure,
> so how would .value work? Which element should be picked up?
> This code looks really wrong to me, but well, I know that this is never an answer ;)
> The question is, what does IE return for document.myname and
> document.myname.myname? Can anyone test that?
> (Mozilla doesn't support document.myname anyway....)
>
> > Btw, doing a '"" + document.myname', generates a 'Type error: No default
> > value' script error.
> Hmm, this means we have no list -> string conversion. What does IE show?

Hmm, yes its not a radio input but a text input with the same name. So
  <form name="myname">
    <input name="myname" type="text">
  </form>

That solves one thing :)
But the function on that page really is:

 function doSubmit(frm) {
    cnt = document.forms.length;
    frm.address_start.value = document.address_start.address_start.value;
    frm.address_stop.value = document.address_stop.address_stop.value;
  }

Are you sure IE gives a collection when an element is a child of the
other?
This site does work with Mozilla and IE.

Koos





More information about the kfm-devel mailing list