In addition to Solution 1:
You can also find plenty of 3rd-party jQuery UI plug-ins collectively known as "modal popup", with different visual effects, such as transitions, and, notably, dimming of the rest of the screen:
http://bit.ly/1DpajUJ.
The benefit of such solution is not just visual effects. This light-weight approach is always better for the user. JavaScript embedded alert and confirmation dialogs create a new window, which is inconvenient, not flexible, looks ugly.
If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery,
http://jquery.com,
http://learn.jquery.com,
http://learn.jquery.com/using-jquery-core,
http://learn.jquery.com/about-jquery/how-jquery-works (start from here).
Remember that jQuery is designed with compatibility in mind.
—SA