try this.... have a function in the head section of the page witch you can call at any time to do your prompt; then call the function from the button in the onclick event, see if that then works ?