Sayfa içerisindeki Div elemanının genişliğini tarayıcı genişliği ile dinamik olarak eşitleyen javascript kodu.

<html>
<
head
>
<title>Dinamik Div</title
>
   <script type
="text/javascript">
   function
getWidthFromClient()
   {
      width();
   }
   window.onresize = function
setWidthFromClient()
   {
      width();
   }
   function
width()
   {
      var
width = window.innerWidth;
      document.getElementById('diva'
).style.width = width;
   }
</script
>
</
head
>
<
body onload
="getWidthFromClient()">
   <div id="diva" style="background-color: Red; height: 100px;
">
   </div
>
</
body
>
</
html
>