Use frames property to access frame instance created with the frame in JavaScript

Description

The following code shows how to use frames property to access frame instance created with the frame.

Example


<html>
<script language="JavaScript">
for(var i = 0; i <= window.frames.length; i++){
document.write("The name of frame #" + i);
document.write(" is " + window.frames[i].name + "<br>");
}<!--from w w  w.  java 2  s  .  c  o m-->
</script>
</html>

Click to view the demo

The code above generates the following result.

Use frames property to access frame instance created with the frame in JavaScript