Window length Property - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window length

Description

The length property returns the number of <iframe> elements in the current window.

This property is read-only.

Return Value

A Number, representing the number of frames in the current window

The following code shows how to check how many <iframe> elements there are in the window:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<iframe src="https://www.cnn.com"></iframe>
<iframe src="https://www.bbc.com"></iframe>
<iframe src="https://www.nytimes.com"></iframe>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {// ww w .  j a  v  a2  s .  c  o m
    var x = window.length;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials