Hi all
I want to get a value using javascript and read it into a php variable.
I am not sure how this is done.

The value I want to get is the Current Document Height

I then want to read that value into a php variable called $current_height.

(After I've got the value in php, I'll write an easy if ... then statement based on the value. )

I think the javascript for getting current document height is


expression(document.all.getElementByID('left-sidebar').style.height

Or something like that. Cannot check until I know how to read it into a variable anyway.

Please can you help me with the syntax for reading this javascript into the variable?

Best
Jo

    Remember that the JavaScript is not actually executed until the page is received by the client. However, the PHP is processed on the server first, after which the resulting page is output to the client, so by the time the JavaScript has calculated the page height, PHP is out of the picture. Possibly you could accomplish this by using an "AJAX" implementation of JavaScript and PHP; but it would add a lot more complexity, increase the time it takes to display the page, and possibly have severe accessibility problems for the 5-10% of users who do not have JavaScript enabled or available if you don't do additional work to accommodate them.

      Write a Reply...