Dynamically Changing Styles

  • Thread starter Dennis M. Marks
  • Start date
D

Dennis M. Marks

Please tell me where to look or answer the following. Can a div or span
style be changed from within the html outside of the div or span? Can
it be done without javascript? What I would like to do is alter the
color of menu items depending on the availability of javascript.

For Example:

<STYLE>
#xxx {color: black}
</STYLE>
 
E

Eric Bohlman

Please tell me where to look or answer the following. Can a div or span
style be changed from within the html outside of the div or span? Can
No.

it be done without javascript? What I would like to do is alter the
color of menu items depending on the availability of javascript.

You can still accomplish that task easily: just set the colors to what you
want them to be if JS is unavailable, and then use an onLoad event to run a
script that changes them.
 
D

Dennis M. Marks

Eric said:
You can still accomplish that task easily: just set the colors to what you
want them to be if JS is unavailable, and then use an onLoad event to run a
script that changes them.

I managed to do it as follows. By default I have the color of specific
lines red. Then a script changes them to black. If there is no
javascript the color remains red and I display a warning message.
See http://www.dcs-chico.com/~denmarks/index.html

Did I use the combination of class and id correctly? The ids are unique
but the class is not.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top