Javascript examples for Browser Object Model:Window frames
Window frames 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() {/* w ww . j a v a2s.c om*/ var frames = window.frames; var i; for (i = 0; i < frames.length; i++) { frames[i].location = "https://www.java2s.com"; } } </script> </body> </html>