Determine the screen resolution of the guest monitor through JS and give a hint
First give the code example:
<script> <!--fw= "1920"; fh= "1200"; var uw=window.screen.width; var uh=window.screen.height; if (FW==UW) {if (Fh==uh) {document.write ("<span class= ' green ' > is perfectly fit for your desktop </span>")} else if (Fh<uh) { document.write ("<span class= ' red ' > not suitable for your desktop </span>")} else {document.write ("<span class= ' yellow ' > Cropping is suitable for your desktop ↘</span> ")}} else if (FW<UW) {document.write (" <span class= ' red ' > size is slightly smaller, not suitable for your computer's tablecloth </span >} else if (FW>UW) {if (Fw/fh==uw/uh) {document.write ("<span class= ' green ' > Fit to do your desktop </span>")} else { document.write ("<span class= ' yellow ' > does not exactly fit your resolution, you can cut it Yourself ↘</span>")}}--> </script>
[ CTRL + A All SELECT Note: If you need to introduce external JS need to refresh to perform]
This code is intended to determine whether the image is suitable for use as a guest's desktop wallpaper by comparing the resolution of the picture and the resolution of the desktop. Where the fw= "1920" and Fh= "1200" after 1920, 1200 are the width of the picture and height parameters, can be read in PHP and other actual picture width and height parameters instead. Before the 11th, 12 lines before the judge I used to use if, yesterday when the desktop resolution to see that there will be 2 tips-if the desktop resolution is larger than the picture resolution, replaced by if the other if parallel code after the error resolution.
In addition, I would like to use the method of PHP to pass the picture width and height, but this to use get advance delivery, or jump or even death cycle, so temporarily only with JS to judge. Of course, there are JS and PHP combination of methods, the effect is not very good.