<!DOCTYPE html>
<html>
<head>
<title>Titre du document</title>
<style>
dialog {
width: 40%;
}
</style>
</head>
<body>
<div>
<dialog id="DialogExample">
<p>
Voici quelque texte par exemple.
</p>
<button id="hide">Fermer la boîte de dialogue</button>
</dialog>
<button id="show">Afficher la boîte de dialogue</button>
</div>
<script type="text/JavaScript">
(function() {
var dialog = document.getElementById('DialogExample');
document.getElementById('show').onclick = function() { dialog.show();
};
document.getElementById('hide').onclick = function() { dialog.close();
};
})();
</script>
</body>
</html>