1.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="bai">
<p>zzu</p>
<p>zzer</p>
</div>
<script type="text/javascript">
var element=document.getElementById("bai");
console.log(element);
</script>
</body>
</html>
2.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<p class="jan">1</p>
<p class="jan">2</p>
<p class="jan">3</p>
<script type="text/javascript">
var elements=document.getElementsByClassName("jan");
console.log(elements);
console.log(elements[0]);
</script>
</body>
</html>
3.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div id="bai">
<p>zzu</p>
<p>zzer</p>
</div>
<p class="jan">1</p>
<p class="jan">2</p>
<p class="jan">3</p>
<script type="text/javascript">
var elements=document.getElementsByTagName("p");
console.log(elements);
for(var i in elements){
console.log(elements[i]);
}
for( var i=0;i<elements.length;i++){
console.log(elements[i]);
}
</script>
</body>
</html>
4.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<input type="password" name="565" id="" value="" />
<input type="password" name="565" id="" value="" />
<input type="password" name="565" id="" value="" />
<input type="password" name="565" id="" value="" />
<script type="text/javascript">
elements=document.getElementsByName("565");
for( var i=0;i<elements.length;i++){
console.log(elements[i]);
}
console.log(elements);
</script>
</body>
</html>