
Introduction
Many times while designing websites we face the problem for selecting the resolution for the site. Here is a small tutorial on how we can solve this problem.
In this tutorial I have used javascript to find the resolution of the client system and depending upon it we can load the page designed for the appropriate system resolution
Code
Here javascript is used to find the current resolution of the the client system which prints the value on the screen .
|
<script>
document.write ("Your screen resolution is : ");
document.write (screen.width); //prints the width of screen in pixels
document.write ( " by ");
document.write (screen.height); //prints the height of screen in pixels
</script> |
It shows the resolution of the screen as shown above.
Now ,the required page can be loaded by using simple if else statement by comparing the current screen resolution to the desired one. The command for loading a page through javascript is
|
location.href = 'index86.htm'; //given in the javascript file inside the if statement
|
The Rest of the Story
The rest is fairly simple. Just extract the files to a folder and open index.htm file .It will detect the resolution and automatically load the page correct for thsat resolution.I hope that this may help some of the beginners in designing .
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here