Hello friends,
If you want to create any website which screen resolution change according to computer screen resolution which is use by user, then you have to find out what is users screen resolution. Is it so difficult?
If you asked with me, then we can say no, it is not difficult. It is so easy man.
Just copy paste below Code in Your Page:
<button onclick="myFunction()">Click to find Now</button>
<p id="width"></p>
<p id="height"></p>
<script>
function myFunction() {
var x = "Total Width: " + screen.width + "px";
document.getElementById("width").innerHTML = x;
var y = "Total height: " + screen.height + "px";
document.getElementById("height").innerHTML = y;
}</script>
Full Code example:
Here we are sharing full HTML code. just copy this HTML code and Paste it on Notepad.
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display the total width of your screen, in pixels and the total height of your screen, in pixels.</p>
<button onclick="myFunction()">Click to find Now</button>
<p id="width"></p>
<p id="height"></p>
<script>
function myFunction() {
var x = "Total Width: " + screen.width + "px";
document.getElementById("width").innerHTML = x;
var y = "Total height: " + screen.height + "px";
document.getElementById("height").innerHTML = y;
}
</script>
</body>
</html>
After That Save it as "screen_resolution.HTML" and Select Save as Type " All Files
Result:
That's It...
Result:
That's It...
