The answer to this depends. If you are trying to process something after the user has already recieved the page, you can't. PHP is server side (code runs before the user gets the page), and JavaScript is client side (code runs after the user gets the page). So you can't make JavaScript interact with PHP without making another call to the server; however, if you want to pass the javascript variable to the server, you can do that using the url, such as
<script language = "JavaScript 1.0">
var someVar = "SomeValue";
document.write("<a href=http://someserver.com/page.php?page=" . someVar . ">Click Here</a>");
Or something similar (my JavaScripting is a little rusty, so I am not sure that it would look exactly like that, but you should know what I mean