Pages

Friday 31 May 2013

How to Get Screen Resolution of User or Client Machine Using JavaScript in c# Asp.Net

How to Get Screen Resolution of User or Client Machine Using JavaScript in c# Asp.Net


Program:

.Aspx File:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Get Screen Resolution using JavaScript</title>
<script type="text/javascript" language="javascript">
function GetResolution(){
document.getElementById("txtWidth").value = screen.width;
document.getElementById("txtHight").value = screen.height;
}
</script>
</head>
<body onload="GetResolution();">
<table>
<tr><td align="center" colspan="2">
<b><span style="color: #990000;">Your Screen Resolution </span></b></td></tr>
<tr>
<td>Width :</td>
<td valign="middle"><input type="text" size="5" name="txtWidth" id="txtWidth">px</td>
</tr>
<tr>
<td>Height :</td>
<td valign="middle"><input type="text" size="5" name="txtHight" id="txtHight">px</td>
</tr>
</table>
</body>
</html>

Live Demo:

Get Screen Resolution using JavaScript
Your Screen Resolution
Width : px
Height : px

No comments:

Post a Comment