|
Posted by rf on 11/30/05 02:09
dorayme wrote:
> I have noticed that type=hidden is often written without quotes.
> For example see
> http://www.scriptarchive.com/readme/formmail.html#recipient who
> seems to know what he is talking about. Is this so, or would it
> be better practice to use quotes as in type="hidden"?
The HTML specs state that attribute values that contain special characters
(those other than alphanumeric and a few others) must be quoted. Attribute
values without special characters don't need to be quoted. Certainly if a
value contains a space it must be quoted.
> He uses
> the quotes on name="" and value="" but not on type="" I have
> seen this before I think. Is there any good reason?
Sloppy coding?
I use quotes for every attribute value rather than relying on remembering
correctly which special characters require quotes.
Additionally, some browsers will accept unquoted values *with* some special
characters. Some browsers will barf on exactly the same value.
1) Don't quote, risk making a mistake that *may not be picked up* in your
test browsers (should be by the validator though) but will break in one of
your viewers browser.
2) Quote everything and be quite safe.
The quotes are required in XHTML anyway, if that ever eventuates.
--
Cheers, Richard.
Navigation:
[Reply to this message]
|