/ Published in: JavaScript

Get your screen resolution use JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<h3>Your Screen Resolution is</h3> <b><h1 id="resolution"></h1></b> <h4 id="width"></h4> <h4 id="height"></h4> <script> function getScreenResolution(){ var width = screen.width; var height = screen.height; var resolution = width+" x "+height; return resolution; } function getWidth(){ return "Screen width: "+screen.width+" pixels"; } function getHeight(){ return "Screen height: "+screen.height+" pixels"; } document.getElementById("resolution").innerHTML = getScreenResolution(); document.getElementById("width").innerHTML = getWidth(); document.getElementById("height").innerHTML = getHeight(); </script>
Comments
