On Apr 21, 12:27 pm, Mel <MelHer...@gmail.comwrote:
>
document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'
}-
Thats a nice piece of code. thanks a whole bunch.
I tried it with my app and i keep getting "Object Required" error
message.
Should I be making changes to your code or should it work the way it
is ?
Create a div with id showID and style: position:absolute.
This should work:
<html><body id="BodyElement">
<script>
document.onmouseover=function(Event){
Event=(Event||event)
Eleme=Event.srcElement||Event.target
if(Eleme){
var idS=document.getElementById("showID")
idS.innerHTML="ID: "+(Eleme.id||"not found")
idS.style.display=''
idS.style.top= Event.clientY+10
idS.style.left=Event.clientX+10
}
}
document.onmouseout=function(){
document.getElementById("showID").style.display='n one'
}
</script>
<a id="a_element">A Element</a><br>
<span id="span element">nt </span><b id="bold-text">BOLD TEXT</b>
<div id="showID" style="position:absolute;border:1px dashed
gray;background-color:white"></div>
</body></html>