[thelist] css class style changes?

James Sabin tr3ks at yahoo.com
Sat Nov 10 17:57:51 CST 2001


we figured it out. the styleSheet object contains the
rules[] array which exposes the classes and other
style rules so you can manipulate them.

here is an example:

<html><head><title>Schedule Test</title>
<style>
  .you{font-weight:normal}
  .me {font-weight:normal}
</style>
<script>
  function setFontWt()
{document.all.you.style.fontWeight='bold'}
  function setFontWt2() {
   
document.styleSheets[0].rules[1].style.fontWeight='bold'
 
    document.styleSheets[0].rules[1].style.color='red'
 
  }
</script>
</head>
<body>
<a href="javascript:setFontWt()">bold the ID</a> <br>
<a href="javascript:setFontWt2()">bold class</a> <br>
<p>  <span id="you">RA</span>                         
 
<p>  <span class="me">ZW</span>
<p>  <span class="me">ZW</span>
<p>  <span class="me">ZW</span>
<p>  <span class="me">ZW</span>
<p>  <span class="me">ZW</span>
</body>
</html>

__________________________________________________
Do You Yahoo!?
Find a job, post your resume.
http://careers.yahoo.com




More information about the thelist mailing list