<html>
<head>
<title></title>
<script type="text/javascript">
function findName() {
var typeStr = "";
var nmStr = "elem1";
var nmList = document.getElementsByName(nmStr);
typeStr += nmList[0].tagName + " ";
alert(typeStr);
}
</script>
</head>
<body onload="findName();">
<div name="elem1">
<ul name="elem2">
<li>option 1</li>
<li name="elem3">option 2</li>
</ul>
</div>
<p name="elem5">Paragraph</p>
<form name="elem6">
<input type="text" name="elem7" />
</form>
</body>
</html>
|