Les instruccions següents obren diferents tipus de caixes de diàleg modal quan l'usuari clica el botó corresponent:

<INPUT TYPE="Button" VALUE="alert" ONCLICK="alert('Has premut el botó alert')">
<INPUT TYPE="Button" VALUE="prompt" ONCLICK="prompt('Escriu el teu nom:', 'Carles')">
<INPUT TYPE="Button" VALUE="confirm" ONCLICK="confirm('Vols sortir d'aquesta finestra?')">