Find out and display a user's screen resolution with javascript.
In javascript, the screen.width and screen.height properties contain the size a visitor's monitor is set to.
This can be useful if you have a page designed for a screen resolution that is higher than some viewers may have available

The following javascript function  is used to get your system screen resolution.

<head>
 
<title>Get Screen Resolution</title>
<script type="text/javascript" language="javascript">
function scrResolution(){
       
var width=screen.width;
        var 
height screen.height;
        document.getElementById("txt_scrWidth").value=width;
        document.getElementById("txt_scrHeight").value=height;
}
</script>

</head>
<body onload="scrResolution();">
  <table width="200" border="0">
     <tr>
       <td>     Width :
     <input name="txt_scrWidth" type="text" id="txt_scrWidth" size="5" />
      </
td>
     
</tr>
     
<tr>
       
<td>
           Height :
       <input name="txt_scrHeight" type="text" id="txt_scrHeight" size="5" />
       </
td>
     
</tr>
    
</table>
</body>
</html>

Your Screen resolution
     Width : px
     Height : px         

1 comments

  1. Anonymous // August 11, 2012 at 8:37 AM  

    nice posting
    how to use variable on javascript can use on php, thanks before

Related Posts Plugin for WordPress, Blogger...