Introduction
Here
I will explain how to Get Monitor screen resolution using JavaScript or Get screen resolution of user in JavaScript.
Description:
In
previous article I explained Set watermark text for textbox using
JavaScript, JavaScript Set Default home page in IE, Mozilla, JavaScript add bookmark link to website and many articles
relating to JavaScript, jQuery, SQL, asp.net etc. Now I will explain how to get
screen resolution of user in JavaScript.
To
get user screen resolution we need to write the code like as shown below
<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
For
live demo check below of your screen resolution details
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
3 comments :
good one..
Nic one
when runat="server" dont show resolution
Note: Only a member of this blog may post a comment.