Displaying Sharepoint elements' Css Class and Id

This useful script can be pasted into the body element of any Sharepoint aspx page through FrontPage and will display an elements css class when hovering over it with the mouse.

<script language="jscript">
function ClassInfo()
{
    if (window.event.srcElement.className != null)
    {
        stsclass.innerText = window.event.srcElement.className;
    }
    else
    {
        stsclass.innerText = "";
    }

    if (window.event.srcElement.id != null)
    {
        stsclass.innerText += window.event.srcElement.id;
    }
    else
    {
        stsclass.innerText += "";
    }
}

window.document.body.onmouseover = ClassInfo;</script>

<div style
="border-style olid;border-width:1px; width: 281px; height: 34px;
position: absolute; left: 286px; top: 41px; z-index:15; padding-left:4px;
padding-right:4px; padding-top:2px; padding-bottom:2px; background-color:#EEEEF4"
>
<p id="stsclasstitle"><font face="Tahoma" id="stsclasstitle">Classname: </font>
<font face="Tahoma"id="stsclasstitle">Classname: </font>
<font face="Tahoma"id="stsclass">&#xa0;</font>
</p></div>

No Comments