document.getElementsByName
In this chapter you will learn:
Get elements by name
getElementsByName(nameOfNameAttribute)
gets
the elements by name and returns HTMLElement[]
.
<!DOCTYPE HTML> <!--from jav a2s.co m-->
<html>
<body>
<p name="apple"> apple</p>
<script>
var nameElems = document.getElementsByName("apple");
document.writeln(nameElems.length);
</script>
</body>
</html>
Next chapter...
What you will learn in the next chapter:
Home » Javascript Tutorial » Document