|
From: Jeff on 23 Apr 2008 09:03 I've just run into a weird quirk in IE where I had named form elements like this: 2-some_name. IE was using just the numeric part as an index in the form collection array. Boy, that took a while to figure out! So, what are the rules for names and ids? I had thought this was loosened up years ago. Jeff
From: Bart Van der Donck on 23 Apr 2008 10:12 Jeff wrote: > I've just run into a weird quirk in IE where I had named form > elements like this: 2-some_name. IE was using just the numeric part as > an index in the form collection array. Boy, that took a while to figure > out! > > So, what are the rules for names and ids? I had thought this was > loosened up years ago. | ID and NAME tokens must begin with a letter ([A-Za-z]) and may | be followed by any number of letters, digits ([0-9]), hyphens | ("-"), underscores ("_"), colons (":"), and periods ("."). http://www.w3.org/TR/REC-html40/types.html -- Bart
From: Henry on 23 Apr 2008 10:22 On Apr 23, 3:12 pm, Bart Van der Donck wrote: > Jeff wrote: >> I've just run into a weird quirk in IE where I had named >> form elements like this: 2-some_name. IE was using just the >> numeric part as an index in the form collection array. Boy, >> that took a while to figure out! > >> So, what are the rules for names and ids? I had thought >> this was loosened up years ago. > > | ID and NAME tokens must begin with a letter ([A-Za-z]) and may > | be followed by any number of letters, digits ([0-9]), hyphens > | ("-"), underscores ("_"), colons (":"), and periods ("."). > > http://www.w3.org/TR/REC-html40/types.html This is relevant for ID attributes, but NAME attributes are CDATA (except for the NAME attributes of META elements, which are NAME tokens) and so the preceding section of - REC-html40/types.html - defines their restrictions. ('2-some_name' may not be a viable ID but it is a valid NAME).
From: Captain Paralytic on 23 Apr 2008 10:24 On 23 Apr, 14:12, Bart Van der Donck <b...(a)nijlen.com> wrote: > | ID and NAME tokens must begin with a letter ([A-Za-z]) and may > | be followed by any number of letters, digits ([0-9]), hyphens > | ("-"), underscores ("_"), colons (":"), and periods ("."). Interesting that it doesn't allow []
From: Rik Wasmus on 23 Apr 2008 10:56 On Wed, 23 Apr 2008 16:24:36 +0200, Captain Paralytic <paul_lautman(a)yahoo.com> wrote: > On 23 Apr, 14:12, Bart Van der Donck <b...(a)nijlen.com> wrote: >> | ID and NAME tokens must begin with a letter ([A-Za-z]) and may >> | be followed by any number of letters, digits ([0-9]), hyphens >> | ("-"), underscores ("_"), colons (":"), and periods ("."). > > > Interesting that it doesn't allow [] Not in ID's, but for PHP luckily in name attributes it's allowed :) From http://www.w3.org/TR/html4/strict.dtd: ..... <!ELEMENT INPUT - O EMPTY -- form control --> <!ATTLIST INPUT %attrs; -- %coreattrs, %i18n, %events -- type %InputType; TEXT -- what kind of widget is needed -- name CDATA #IMPLIED -- submit as part of form -- ..... So, just CDATA in name attributes. -- Rik Wasmus
|
Next
|
Last
Pages: 1 2 Prev: scrollbar to iframe through javascript. Next: comp.lang.javascript FAQ - META 2008-04-23 |