Javascript examples for Browser Object Model:Window length
Window length Property - Loop through all frames on a page, and change the location of all frames
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <br><br> <iframe src="https://www.cnn.com"></iframe> <iframe src="https://www.bbc.com"></iframe> <iframe src="https://www.nytimes.com"></iframe> <script> function myFunction() {//from w ww . j ava2 s . c o m var frames = window.frames; var i; for (i = 0; i < frames.length; i++) { frames[i].location = "https://www.java2s.com"; } } </script> </body> </html>