selected=selected in the center of option list

Discussion in 'HTML' started by John, Mar 1, 2010.

  1. John

    John Guest

    Hi

    I have <option value='6' selected=selected>whatever</option> in a <select>
    list.

    In IE the option appears at the top of the list.
    in FF it appears at the bottom of the list.

    Any way of getting the option to appear in the middle of the list?

    Regards
    John
    John, Mar 1, 2010
    #1
    1. Advertising

  2. John

    rf Guest

    "John" <> wrote in message
    news:hmg5bv$en0$...
    > Hi
    >
    > I have <option value='6' selected=selected>whatever</option> in a <select>
    > list.
    >
    > In IE the option appears at the top of the list.
    > in FF it appears at the bottom of the list.
    >
    > Any way of getting the option to appear in the middle of the list?


    Is there any possible way you can give us any less information?

    For example not providing the URL to the offending page. Or not even
    providing the full <select> element?

    In any case I determine that you have an error in line 42.
    rf, Mar 1, 2010
    #2
    1. Advertising

  3. John wrote:
    > Hi
    >
    > I have <option value='6' selected=selected>whatever</option> in a <select>
    > list.
    >
    > In IE the option appears at the top of the list.
    > in FF it appears at the bottom of the list.
    >
    > Any way of getting the option to appear in the middle of the list?
    >


    If you have

    selected=selected

    then the tag is invalid. If your document is meant to be HTML, then it
    should just be

    selected

    If it's meant to be XHTML, then it needs to be

    selected="selected"

    because attribute values must be quoted in XHTML.

    I don't know if fixing that will solve your problem, but other than that
    I have no way to know what the source of your problem is because you
    haven't shared any of your code outside of that one option element.
    Harlan Messinger, Mar 1, 2010
    #3
  4. Harlan Messinger wrote:

    > If you have
    >
    > selected=selected
    >
    > then the tag is invalid.


    No it isn't.

    > If your document is meant to be HTML, then it
    > should just be
    >
    > selected


    No, selected=selected and selected="selected" and selected='selected' are
    all permitted and equivalent in HTML up to and including HTML 4.01. Ref.:
    the end of
    http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3.4
    (which is outdated, as browsers that only recognize the minimized form must
    be really rare nowadays).

    The shorthand that consists of the value selected only is often described as
    being the attribute name without value, but by the SGML standard, and hence
    formally in HTML up to and including HTML 4.01, it is the value of an
    attribute. However, in this special case, the attribute value must not
    appear in quotation marks. Rather confusing, isn't it?

    This explains the oddity that in a <table> tag, the word border may appear
    alone and it means frame="border". It's thus interpreted as the value of the
    attribute that has this value as one of the possible enumerated values. In
    principle, you could also use <table hsides rows> (try it on a validator if
    you don't believe me) and it would mean <table frame="hsides" rules="row">
    but don't expect browsers to grok it. In practice, browsers don't do SGML
    parsing but some kludgery, which among other things deals with <table
    border> or <option selected> as constructs treated on an ad hoc basis, not
    via general SGML minimization rules.

    > If it's meant to be XHTML, then it needs to be
    >
    > selected="selected"


    Or selected='selected', to be exact.

    > I don't know if fixing that will solve your problem,


    I don't think the problem has anything to do with the format of the
    attribute used, or that attribute at all.

    The problem is most probably in the code that was used to generate the
    markup client-side via JavaScript, thereby exhibiting differences between
    browsers. I might be stretching my crystal ball too much, but the error
    seems to be at line 42 of the code. I might be wrong here of course. What is
    fairly certain is that the URL is needed if the OP wants his problem solved
    and not just enjoy our lectures (which are of course infinitely more
    interesting than some casual boring practical authoring issue, in a context
    where the whole approach is probably wrong).

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Jukka K. Korpela, Mar 1, 2010
    #4
  5. Jukka K. Korpela wrote:
    > Harlan Messinger wrote:
    >
    >> If you have
    >>
    >> selected=selected
    >>
    >> then the tag is invalid.

    >
    > No it isn't.
    >
    >> If your document is meant to be HTML, then it
    >> should just be
    >>
    >> selected

    >
    > No, selected=selected and selected="selected" and selected='selected'
    > are all permitted and equivalent in HTML up to and including HTML 4.01.
    > Ref.: the end of
    > http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.3.4
    > (which is outdated, as browsers that only recognize the minimized form
    > must be really rare nowadays).


    I stand corrected. Sorry/thanks.
    Harlan Messinger, Mar 1, 2010
    #5
  6. John

    dorayme Guest

    In article <dxNin.10524$>,
    "rf" <> wrote:

    >
    > "John" <> wrote in message
    > news:hmg5bv$en0$...
    > > Hi
    > >
    > > I have <option value='6' selected=selected>whatever</option> in a <select>
    > > list.
    > >
    > > In IE the option appears at the top of the list.
    > > in FF it appears at the bottom of the list.
    > >
    > > Any way of getting the option to appear in the middle of the list?

    >
    > Is there any possible way you can give us any less information?
    >
    > For example not providing the URL to the offending page. Or not even
    > providing the full <select> element?


    These last possibilities are actualities in this case. Less
    information would have to be something like providing a totally
    irrelevant URL that throws any would-be helper off even a wild
    guess.

    --
    dorayme
    dorayme, Mar 1, 2010
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick Olurotimi Ige
    Replies:
    6
    Views:
    506
    =?Utf-8?B?TmljZW1hbg==?=
    Mar 11, 2005
  2. Dennis Marks
    Replies:
    1
    Views:
    3,378
    Nikita the Spider
    Sep 8, 2006
  3. Serge Myrand

    Posting a selected option (drop down list)

    Serge Myrand, Jul 22, 2004, in forum: ASP General
    Replies:
    2
    Views:
    115
    Serge Myrand
    Jul 22, 2004
  4. Mark Kolber
    Replies:
    4
    Views:
    326
  5. Replies:
    7
    Views:
    239
Loading...

Share This Page