PDA

View Full Version : How to pass a php session var to a javascript func



cacooke
12-06-2003, 08:08 PM
Well,
That is basically it,
I have an onUnload event that calls a javascript function to display 1 of 2 popups.
The variable that is used to decide which popup to show is in a php session.

Can someone please tell me how to assign/pass that session var to the javascript function...

Thanks
CAC

brettgodfrey
04-29-2004, 01:39 PM
CAC
I know it's a long time since your post but I only found it today while looking to do the same thing.

The only solution I have is to use the php echo statement to generate the script.

In my case I wanted to focus on a link. Which link was defined by a php variable.

<? echo "
<script>
<!--
document.links[".$link."].focus();
//-->
</script>";?>


Hope this is not toooooo late to be of use.