JavaScript DHTML/Document/all

Материал из Web эксперт
Перейти к: навигация, поиск

Check if a tag exists

   <source lang="html4strict">

<html> <head> <title>A Simple Page</title> <script language="JavaScript"> function findhead1() {

   var detectElement = document.all("head1");
   if (detectElement == head1) 
   {
       alert("Element \"head1\" exists");
   }

} </script> </head> <body onload="findhead1()">

Heading One

</body> </html>

 </source>