By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,573 Members | 3,017 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,573 IT Pros & Developers. It's quick & easy.

Style in Option Statement

P: n/a
Please look at page http://www.dcs-chico.com/~denmarks/amtrak.html

I am trying to change the color of the first dropdown menu but
everything that I have tried has no effect.

If I put the style in the select statement the color only applies to
the undroppeddown menu. When opened the color disappears. In the option
statement it has no effect.

I have tried IE and Netscape on a Mac.

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
AV
you should put your style declaration applying it to the OPTION tag: the
select affects all the options, but if you include a styule statement (even
via script) to a single option or to more options, that would positively
override for the affected option the select style statements (on my website
the what's new multiple select menu in the second page alternates the option
colors in that way for instance).
I don't know what happens with a mac though.
I hope this helps a little bit at least
ciao
Alberto
http://www.unitedscripters.com/
"Dennis M. Marks" <de******@dcsi.net> ha scritto nel messaggio
news:291120031038448099%de******@dcsi.net...
Please look at page http://www.dcs-chico.com/~denmarks/amtrak.html

I am trying to change the color of the first dropdown menu but
everything that I have tried has no effect.

If I put the style in the select statement the color only applies to
the undroppeddown menu. When opened the color disappears. In the option
statement it has no effect.

I have tried IE and Netscape on a Mac.

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Jul 20 '05 #2

P: n/a
I have added the following to my HTML

<style type="text/css">
SELECT {color:red; background-color:blue}
OPTION {color:red; background-color:blue}
</style>

The SELECT works, the OPTION does not. Why?

See page http://www.dcs-chico.com/~denmarks/amtrak.html

In article <29*************************@dcsi.net>, Dennis M. Marks
<de******@dcsi.net> wrote:
Please look at page http://www.dcs-chico.com/~denmarks/amtrak.html

I am trying to change the color of the first dropdown menu but
everything that I have tried has no effect.

If I put the style in the select statement the color only applies to
the undroppeddown menu. When opened the color disappears. In the option
statement it has no effect.

I have tried IE and Netscape on a Mac.


--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #3

P: n/a
Dennis M. Marks wrote on 29 Nov 2003:
I have added the following to my HTML

<style type="text/css">
SELECT {color:red; background-color:blue}
OPTION {color:red; background-color:blue}
</style>

The SELECT works, the OPTION does not. Why?
At present, they are identical styles, so you couldn't see any
changes in any case. However, applying a colour style to OPTION in
IE6/Win does work (as I said in my reply to your original post).
See page http://www.dcs-chico.com/~denmarks/amtrak.html


As I said in my reply to your original post, not all browsers will
support this. Even if they did, users can disable your style sheet
(and with those colours, I would). You shouldn't rely on presentation
alone to communicate meaning, that should be done with structure.

Mike

And please don't top-post.

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #4

P: n/a
As I said the styles did not work for the OPTION statement when used
inline (styles=) or in <STYLES></STYLES>. When I set the styles for
both the SELECT and OPTION the same as you last saw it, it only colored
the first line.

I solved the problem by changing the SIZE parameter on the SELECT
statement which makes the page look better anyway. Now the styles work.
I am now using 3 different colors. It looks like it does not work when
the SIZE=1, at least on a Mac.

BTW: I tried using IE and Navigator on a Mac.

--
Dennis M. Marks
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 20 '05 #5

P: n/a
Dennis M. Marks wrote on 29 Nov 2003:
As I said the styles did not work for the OPTION statement when
used inline (styles=) or in <STYLES></STYLES>. When I set the
styles for both the SELECT and OPTION the same as you last saw
it, it only colored the first line.

I solved the problem by changing the SIZE parameter on the
SELECT statement which makes the page look better anyway. Now
the styles work. I am now using 3 different colors. It looks
like it does not work when the SIZE=1, at least on a Mac.

BTW: I tried using IE and Navigator on a Mac.


There's a syntax error in your (inline) script. In the for loop, you
have this code:

if (Trains[i][3][0]=="NA") {document.write("<OPTION id=blue>");};
else {if (Trains[i][3][0]=="DD") {
document.write("<OPTION id=red>");};
else {document.write("<OPTION id=green>");};};

The terminating semi-colons should not be there. You should re-write
it like this:

if (Trains[i][3][0]=="NA") {
document.write("<OPTION id=blue>");
} else if (Trains[i][3][0]=="DD") {
document.write("<OPTION id=red>");
} else {
document.write("<OPTION id=green>");
}

I also feel that elseif equivalent statements are more readable if
presented as I wrote above. Of course, that's purely a subjective
comment. If you don't like it, the above could be presented:

if (Trains[i][3][0]=="NA") {
document.write("<OPTION id=blue>");
} else {
if (Trains[i][3][0]=="DD") {
document.write("<OPTION id=red>");
} else {
document.write("<OPTION id=green>");
}
}

Mike

--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.