On Fri, 15 Dec 2006 23:22:13 -0600 (CST), "Richard Lynch" wrote:

>     $selected = $l == $limit ? 'selected="selected"' : '';
>     echo "<option value=\"$l\" $selected>$l</option>\n";

[snip]

> The value="x" *is* optional, but you'll never convince the people who
> tell you it isn't, unless you force them to read the RFCs and W3C
> recommendations [*], so it's easier to include it than to argue with
> them. :-)

   It is indeed optional, and the HTML spec.[1] even says
that if the attribute is not set, the initial value is
set to the contents of the element. That's all good and
well.

   What's not all good and well are browser implementations.
If you try to retrieve the value from JavaScript (by way
of option.value or select.value) in IE 5.5 [2] and several
versions of Opera [3], you may find the value is simply
not there *unless* you spell it out in HTML.

   Of course, it could be argued that there is a conceptual
difference between the value attribute (as written in HTML
and seen through the JS DOM) and the element value (rendered
by the user agent and passed as part of a form submission).
But that is a different story for a different group (or list).
I fear that I have now strayed so far off topic that I should
volunteer myself for killfile membership. :-)


--nfe


[1]: I'm not going to bother checking the XHTML spec.
[2]: I don't know about other versions.
[3]: The bug dates back to at least Opera 7.23. I reported
     it in july 2004 against 7.52, as did others before me.
     It was finally fixed in 9.00 preview 1, some two years
     after I reported it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to