Newer browsers let you open and close a dialog with HTML only, using the commandfor and command attributes on a button:
Hello! No JavaScript needed.