no can do. While you can generate javascript via php, you cannot embed javascript in php - the reason being that php does all of its work on the server and javascript does all of its work in the client browser.