Does JavaScript support percentage unit?
<p>I'm trying to re-size an image according to different browser sizes.  I'm using this code:</p>

<pre><code>document.getElementById("myImg").style.height = (document.body.clientHeight) * 0.5;
</code></pre>

<p>But it works if I'm not using <code>DOCTYPE</code>, if I use <code>DOCTYPE</code> in my html file, then it doesn't work.  Someone said:</p>

<blockquote>
  <p>In using a valid DTD attribute values must have units...</p>
</blockquote>

<p>So I tried to add percentage unit <em>%</em>:</p>

<pre><code>document.getElementById("myImg").style.height = (document.body.clientHeight) * 0.5 + "%";
</code></pre>

<p>but it doesn't work, and it only works with <em>px</em> unit instead:</p>

<pre><code>document.getElementById("myImg").style.height = (document.body.clientHeight) * 0.5 + "px";
</code></pre>

<p>How can I make work with <em>%</em> unit as it works with <em>px</em> unit? Is that even possible?</p>
