you can generate javascript just like you can generate html. Sure you can't change the variable, but he didn't ask that. You can use any php variable and pass it to some javascript code no problem. That's how a lot of libraries to make javascript stuff easier is coded...