<html>
<head>
<title> Get the specified element of HTML file </title>
<script language= "JavaScript" >
Function GetElement1 () {
Alert (document.all ("myH2"). TagName);
}
Function GetElement2 () {
alert (myh2.tagname);
}
Function Showtags () {
Alert (document.all.tags ("P"). length);
}
Function Showitems () {
var strtags = ';
for (var i=0; i<document.all["MyTag"].length; i++) {
Objele = document.all ("MyTag"). Item (i);
Strtags + + objele.tagname + "";
}
Alert (strtags);
}
</script>
</head>
<body id= "Mybody" >
<h2 id= "myH2" > get the specified element of the HTML file </ H2>
<hr>
<p id= "MyTag" > Get <b id= "MyTag" >HTML</b> file elements body
<p id= "MyTag" > Get the elements of the <b>HTML</b> file H2
<h3 id= "MyTag" > get the Elements of <b>HTML</b> files p</h3>
<form >
<input type= "button" onclick= "GetElement1 ()" value= "get the specified element" >
<Input type= "button" onclick= "GetElement2 ()" value= "get the specified element" >
<input type= "button" onclick= "Showtags ()" Value= "How many p elements" >
<input type= "button" onclick= "Showitems ()" value= "show MyTag elements" >
</form>
</body>
</html>