You're getting ahead of yourself.
'tis impossible to do such a thing.
PHP is parsed by the server, JavaScript by the browser.
So what your doing is echoing the JavaScript, then trying to deal with an undefined integer (in this case you are trying to divide a string). Then, once the whole page gets to the browser,
then the JavaScript is parsed; never beforehand.
I can think of a way to do this using AJAX, but would be a bit tedious. I'll explain it just incase it brings a spark to your mind.
First, echo the first bit you had, with JavaScript then grabbing the document size. Use an onload handler to call a function that will grab the window size, do your math, then use AJAX to send this to a PHP script, which will then do whatever you need with it. If needed, PHP can echo whatever data you need, then have the function update the page with that data.
Edit-
Then again, Matt has pointed someone else to a page relating directly on this subject.
http://php.net/manual/en/faq.html.php#faq....script-variable
Edited by Demonslay, 11 November 2006 - 03:08 PM.