The only scripting that exists is to determine whether the page is about to be "unloaded". That means they might have clicked on one of your links, or they close the page, or navigate to a different web site, or submit your form. Determining if the page is about to be unloaded only works in some web browsers.
In terms of security, web browsers do not allow you to lock people in. There are though
modal dialog-boxes, where people cannot do anything with your current page, until they deal with the dialog.
Bookmarks