<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>