Re: why does this not work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>";

You know that PHP runs on the server, right? So how exactly is it supposed to find out the width of the client's screen?

And you're just putting that string into a variable, the JavaScript isn't going to get executed unless you output it to the client, and even then it will be executed on the client, not the server.

You could implement the stylesheet switching entirely on the client anyway, but you might want to look at your CSS and see why exactly you need to do this, and if there's another way.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux