You are here: Re: [PHP] why does this not work? « PHP « IT news, forums, messages
Re: [PHP] why does this not work?

Posted by Jordan Miller on 09/27/05 11:31

javascript is a client-side language, while php is a server-side
language... the value you are passing to $width only exists on the
client side, therefore the php server-side boolean fails.

i think you will have to pass the client-side calculated variable of
screen.width to the php server before you can do this properly,
probably through a POST form or GET request. nice idea, though
(dynamically loading css based on screen resolution).

see:
http://forums.devshed.com/t3846/s.html

Jordan


On Sep 27, 2005, at 3:20 AM, Ross wrote:

> This returns the correct value for $width but falls down on the
> boolean. I
> have tried intval/srtval but nothing seems to work.
>
> Maybe it is too early!
>
> $width = " <script> document.write(screen.width); </script>";
> //$ross= intval($width);
>
> echo $width;
> if ($width < 1064) {
> echo "lower";
> $style= "style1.css";
>
> }
> else {
> $style= "style2.css";
>
> }
>
>
> R.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>

 

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

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