Re: Simple question

From: Date: Tue, 27 Apr 2004 10:11:33 +0000
Subject: Re: Simple question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-184743@lists.php.net to get a copy of this message
"William Stokes" <kalles@operamail.com> wrote in message news:20040427073448.90842.qmail@pb1.pair.com... > probably? ;-) > > I need to determine users resolution and place objects on the page according > to that information. I'm trying to get this work but it doesn't. It always > ends up with echoing "large". I really don't know why. Can anyone help me? > > Here's the script: > > <?php > DEFINE('RESOLUTION','<script > language="javascript">document.write(screen.width+" x > "+screen.height);</script>'); > $res = RESOLUTION; > echo "$res"; > echo "<br>"; > echo (gettype($res)); > echo "<br>"; > > if ($res == '800 x 600'){ > echo "small"; > } > else if ($res == '1024 x 768'){ > echo "medium"; > } > else { > echo "large"; > } > ?> I think your JS code is not recognized because it's in your php code and not in the HTML section of your page. JS is interpreted by the browser AFTER the page is generated and therefore AFTER your php is processed. Do a echo RESOLUTION to see the value. Regards, Torsten

« previous php.general (#184743) next »