Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][HTML][JavaScript]Sprawdzanie rozdzielczości ekranu
patryk9200
post
Post #1





Grupa: Zarejestrowani
Postów: 319
Pomógł: 4
Dołączył: 7.02.2009
Skąd: pless

Ostrzeżenie: (0%)
-----


witam!
Jest może możliwość sprawdzenia przez stronę (php, html itp.) jaką ma użytkownik rozdzielczość i do rozdzielczości przypisac np. zmienną?
albo instrukcję warunkową, że wyswietla dany kod przy danej rozdzielczosci?

Ten post edytował patryk9200 14.02.2009, 19:07:11
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
patryk9200
post
Post #2





Grupa: Zarejestrowani
Postów: 319
Pomógł: 4
Dołączył: 7.02.2009
Skąd: pless

Ostrzeżenie: (0%)
-----


hmm... a nie z na ktoś innego rozwiązania?
znalazłem jeden skrypt ale nie wiem czemu nie działa;/
oto on
  1. <?php
  2. <script LANGUAGE='JavaScript'>
  3.  
  4. <!-- This script and many more are available free online at -->
  5. <!-- The JavaScript Source!! <a href=\"http://javascript.internet.com\" target=\"_blank\">http://javascript.internet.com</a> -->
  6. <!-- Original:  Hamid F. Fard (hamid@petanet.com ) -->
  7. <!-- Web Site:  <a href=\"http://www.petanet.com\" target=\"_blank\">http://www.petanet.com</a> -->
  8. <!-- Begin
  9.  var ScrnSize = 'UnCommon'
  10.  
  11.  if (navigator.appVersion.indexOf('4.') != -1 &&
  12.      navigator.appName.indexOf('Explorer') != -1) {
  13.     ScrnSize = screen.width + 'x' + screen.height;
  14.  }
  15.  if (navigator.appVersion.indexOf('4.') != -1 &&
  16.      navigator.appName.indexOf('Netscape') != -1) {
  17.     ScrnSize = screen.width + 'x' + (screen.height + 19); //Netscape sees 19 pixels less on Height
  18.  }
  19.  switch(ScrnSize) {
  20.    case '640x480':   document.write('<body bgcolor='#FF0000' text='#000000'>');
  21.    case '800x600':   document.write('<body bgcolor='#00FF00' text='#000000'>');
  22.    case '1024x768':  document.write('<body bgcolor='#0000FF' text='#000000'>');
  23.    case '1152x864':  document.write('<body bgcolor='#FFFF00' text='#000000'>');
  24.    case '1280x1024': document.write('<body bgcolor='#AA0000' text='#000000'>');
  25.    case '1600x1200': document.write('<body bgcolor='#FF00FF' text='#000000'>');
  26.    case '1600x1280': document.write('<table align=left border=0 style='position: absolute; top: 0; left:20%; z-index: 0'>
  27. <tr><td>
  28.  
  29. ".$baner12."
  30. ".$baner13."
  31. ".$baner14."
  32. ".$baner15."
  33. ".$baner16."
  34. </tr></td>
  35. <br><br>
  36. </body>
  37. </html>');
  38.    default:          document.write('<body bgcolor='#FFFFFF' text='#000000'>');
  39.  }
  40.  
  41. // The following 3 lines are for display only. They can safely be removed.
  42.  document.write('Browser Type=' + navigator.appName + '<BR>');
  43.  document.write('Browser Version=' + navigator.appVersion + '<BR>');
  44.  document.write('Screen Resolution=' + screen.width + 'x' + screen.height);
  45.  
  46. //  End -->
  47. </script>";
  48. ?>


A dodam, że moja mama ma np. 24cal monitor i rozdzielczość bagatela 1920x800.....
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 15.10.2025 - 00:47