If you are asking how to display HTML markup as such in a warning window, do it:
alert("\<html\>\<body\>\<h1\>this is alert heading\</h1\>\</html\>\</body\>")
If you ask how to format the warning window using HTML, you cannot. You need to create a modal dialog box, as one of the other answers shows.
source share