JavaScript DHTML/Javascript Properties/id
Element name and id
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function tagInfo()
{
var tag;
tag = "Name:" + window.event.srcElement.tagName + " ID:" + window.event.srcElement.id;
window.status = tag;
}
</script>
</head>
<body onMouseover="tagInfo()" id="body1">
<h1 id="head1">Heading One</h1>
<p id="para1">Some text</p>
</body>
</html>
Parent Tag name
<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
function tagInfo()
{
var tag;
tag = " Parent:" + window.event.srcElement.parentElement.tagName;
window.status = tag;
}
</script>
</head>
<body onMouseover="tagInfo()" id="body1">
<h1 id="head1">Heading One</h1>
<p id="para1">Some text</p>
</body>
</html>