php is server side. javascript is client side. you can do something like this:
<HTML>
<BODY>
<SCRIPT LANGUAGE="Javascript">
alert('Your IP is: <? echo $REMOTE_ADDR; ?>');
</SCRIPT>
</HTML>
</BODY>
when the page is handled by php the remote ip address will be placed in the content being sent to the clients browser. when the javascript runs it will then show that ip address to the user. so php can modify javascript but javascript can't interact with php without refreshing the page (GET/POST).