JSFiddle - React, Tailwind, and code Playground
HTML
<a href="" onclick="message('I am a <i>formatted</i> <span style="color: red">message</span>'); return false">Show a message</a>
<a href="" onclick="message('<h1>Heading...</h1><p>... and message'); return false">Show another message</a>
JavaScript
var hider=shower=undefined
function message(text)
{
if (!hider) {
hider=document.createElement('div')
with (hider.style) {
position='fixed'
left=top=0
width=height='100%'
zIndex=1001
backgroundColor='black'
opacity=.25
}
hider.onclick=message
document.body.appendChild(hider)
shower=document.createElement('div')
with (shower.style) {
position='fixed'
left=top='25%'
width='50%'
zIndex=1002
textAlign='center'
backgroundColor='white'
padding='10px'
}
shower.onclick=message
document.body.appendChild(shower)
}
if (typeof text=='string') {
shower.innerHTML=text
hider.style.display=shower.style.display='block'
} else {
hider.style.display=shower.style.display='none'
}
}