Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > selected=selected in the center of option list

Reply
Thread Tools

selected=selected in the center of option list

 
 
John
Guest
Posts: n/a
 
      03-01-2010
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


 
Reply With Quote
 
 
 
 
rf
Guest
Posts: n/a
 
      03-01-2010

"John" <(E-Mail Removed)> wrote in message
news:hmg5bv$en0$(E-Mail Removed)...
> 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.




 
Reply With Quote
 
 
 
 
Harlan Messinger
Guest
Posts: n/a
 
      03-01-2010
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.
 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      03-01-2010
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/

 
Reply With Quote
 
Harlan Messinger
Guest
Posts: n/a
 
      03-01-2010
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.

 
Reply With Quote
 
dorayme
Guest
Posts: n/a
 
      03-01-2010
In article <dxNin.10524$(E-Mail Removed)>,
"rf" <(E-Mail Removed)> wrote:

>
> "John" <(E-Mail Removed)> wrote in message
> news:hmg5bv$en0$(E-Mail Removed)...
> > 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
no 'option' in aspx file means 'option'="false"? Cas ASP .Net 5 08-28-2006 10:36 AM
Form option list adding a 2nd option based upon the first. mike.a.rea@gmail.com Javascript 7 02-17-2006 02:13 AM
Naming of core NASA center with the words "Mission Control Center" & mass use of religious anthem sounding word "Mission" in Context of Space Exploration & the Moon Landing Hoax moonlandinghoaxreligious@yahoo.com Digital Photography 0 09-27-2005 08:28 PM
Dynamically update SELECTED option in option list Mark Kolber Javascript 4 01-01-2005 02:07 PM
g++ -pg option and -shared option Julien ROUZIERES C++ 1 12-21-2004 02:30 PM



Advertisments