Hi,
java - is fixed text?
123 - survey id
....
You're right (better to look at source code to get exact id's)
I gave you a base of javascript snippet as asked in your title...because i supposed it was to display an alert or confirm message via the browser prompt box. In this case the JS code have to be on the same page. (if pop-up=external page, place your code at the next page but you have to set and test everything...)
Another approach is to use 'expression manager' and its powerful set of functions for validation.
Ben