You are here: Re: Screen resolution « PHP Programming Language « IT news, forums, messages
Re: Screen resolution

Posted by Chung Leong on 10/17/06 05:45

Steve Wright wrote:
> Hi
>
> I'm developing a webpage that needs to include a different stylesheet
> depending on the screen resolution.
>
> I know that I could read the resolution in javascript and then do some
> sort of stylesheet switcher as part of the onload event but I would
> rather link in the correct stylesheet for the resolution in the first
> place.
>
> Is there anyway of reading the screen resolution using PHP?

Nope. The use of document.write (circa 1990s) will work just as well
though.

<script>

var css = 'norm.css';

if(screen.availHeight > 1024) {
css = 'big.css';
}
/* ... etc. ... */

document.write('<link rel="stylesheet" type="text/css" href="' + css +
'">');

</script>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация