JavaScript .style.display?
<p>I want to get display attribute from an HTML element. When I write inline CSS, it works, but if I use a class it doesn't. </p>

<p>This works:</p>

<pre><code>&lt;p id="p1" style="display:none;"&gt;This is some text.&lt;/p&gt;​
&lt;script&gt;alert(document.getElementById("p1").style.display);&lt;/script&gt;
</code></pre>

<p><a href="http://jsfiddle.net/bwzAN/2/" rel="nofollow">http://jsfiddle.net/bwzAN/2/</a></p>

<p>This does not work:</p>

<pre><code>&lt;style&gt;.deneme{ display: none; }​&lt;/style&gt;
&lt;p id="p1" class="deneme"&gt;This is some text.&lt;/p&gt;​
&lt;script&gt;alert(document.getElementById("p1").style.display);&lt;/script&gt;
</code></pre>

<p><a href="http://jsfiddle.net/bwzAN/7/" rel="nofollow">http://jsfiddle.net/bwzAN/7/</a></p>

<p>Why? Is it possible to make the second case behave like the first? How can I fix it?</p>
