Creating DIV dynamically, is not taking height and width on fly
<p>I want to create div dynamically based on some calculations.I am able build div's dynamically but the only issue is it's not taking height and width on fly.please any one share their view or code if possible.</p>

<p>Here's the script which i used for your reference.</p>

<pre><code>&lt;script type="text/javascript" language="javascript"&gt;
   function createDiv()
   {
            var totalheight=400;
            var totalwidth = 600;
            var height = 80;
            var width = 40;
            var divheight = totalheight / height;
            var divwidth = totalwidth / width;
            var id=1;

            for(var i=1;i&lt;=divheight;i++)
            {
                var eh=divwidth;
                var fh=1;
                for (var w = 1; w &lt;= divwidth; w++)
                {
                   var div=document.createElement("&lt;div id='"+id+"' style=\"background:#F0E68C;width:'"+width+"'px;height:'"+height+"'px;border:solid 1px #c0c0c0;padding: 0.5em;text-align: center;float:left;\"&gt;&lt;/div&gt;"); 
                   document.body.appendChild(div);
                   eh=eh+divheight;
                   fh=fh+divheight;
                   id++;
                }
                 var div1=document.createElement("&lt;br/&gt;");
                 document.body.appendChild(div1);
            }     
    }
    &lt;/script&gt;
</code></pre>

<p>Thanks in advance.</p>
