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
Determine the screen resolution of the guest monitor through JS and give a hint
First give the code example:
<textarea id="runcode51847"><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></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
This code is intended to determine whether the change is appropriate for a desktop wallpaper that is directly used as a visitor by comparing the resolution of the picture with the desktop resolution. 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.
You would otherwise want to use the method of PHP to pass picture width and height, but in order 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.