title: Changing a property of a external CSS with javascript
body: <p>First of all, sorry for bad english.</p>
  
  <p>Well, I need to change the color property of all parragraphs, using javascript, here's my html&amp;JS code:</p>
  
  <pre><code>&lt;body&gt;
  &lt;p&gt;Parragraph one&lt;/p&gt;
  &lt;p&gt;Parragraph two&lt;/p&gt;
  &lt;button onclick="CE()"&gt;change style&lt;/button&gt;
  &lt;/body&gt;
  
  for (var j=0;j&lt;document.styleSheets[0].cssRules.length;j++) {
    if(document.styleSheets[0].cssRules[j].selectorText='p')
      document.styleSheets[0].cssRules[j].style.color="#FF0000";
  }
  </code></pre>
  
  <p>And this is my CSS code:</p>
  
  <pre><code>p{
      color: green;
      font-size: 20px;
      font-weight: bold;
      font-family: arial;
  }
  </code></pre>
  
  <p>I tried to change it with this too: <code>document.styleSheets[0].cssRules[0].style.backgroundColor="#FF0000"</code>;
  (trying to change the background color, just to see if it works, but only works on Mozilla Firefox)</p>