The javascript should be with event onmouseover
function mostrarID() {
.........................
.........................
}
document.onmouseover = mostrarID;
HTML example
O ID é:"<span id="span" style="font-weight:bold"></span>"<br>
<p id="p1">Paragrafo</p>
<div id="Div1">
<p id="p2">Paragrafo2</p>
<hr id="hr1">
<a href="#" id="Home">Home</a>
</div>
<p id="p3">Paragrafo3</p>
<a href="#" id="nav-questions">Perguntas</a>
<p id="p4">Paragrafo4</p>
<a href="#" id="Tags">Tags</a>
<div id="Div2">
<form id="Form">
<input id="Input" type="text"/>
</form>
</div>