Use document.all(elementId) to get the element : all « Document « JavaScript Tutorial






<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
function findhead1()
{
    var detectElement;
    detectElement = document.all("head1");
    if (detectElement == head1)
    {
        alert("Element \'head1\' exists");
    }
}

//  -->
</script>
</head>
<body onload="findhead1()">
<h1 id="head1">Heading One</h1>
</body>
</html>








14.3.all
14.3.1.document.all
14.3.2.document.all.item()
14.3.3.document.all.tags()
14.3.4.List all elements by reference the document.all
14.3.5.Use document.all(elementId) to get the element