Outline ·
[ Standard ] ·
Linear+
Detect browser size then display appropriate pic
|
TSJarod
|
Feb 13 2006, 06:37 PM, updated 20y ago
|
|
anyone know how to use javascript to detect the browser resolution then with that info determine what size picture to display? eg. if screen.width=1024 show picture_1024. if screen.width=800 show picture_800.
|
|
|
|
|
|
snow
|
Feb 13 2006, 10:39 PM
|
|
CODE <script language="JavaScript"> if (screen.width == 1024) { document.write("<img src='images/picture_1024.jpg'>"); } else if (screen.width == 800) { document.write("<img src='images/picture_800.jpg'>"); } </script>
|
|
|
|
|
|
TSJarod
|
Feb 14 2006, 08:38 AM
|
|
thank you very much!
|
|
|
|
|