<html> <head> <script> window.name = "foo"; function simulateClick(target) { var evt = document.createEvent("MouseEvents"); evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); return target.dispatchEvent(evt); } function openWindow(url) { window.open(url); return true; } function removeFrame() { var frame = document.getElementById('1-2-id'); frame.parentNode.removeChild(frame); return true; } function addFrame() { var frame = document.createElement('iframe'); frame.setAttribute('src', '1-2.html'); document.body.appendChild(frame); return true; } </script> </head> <body> Top frame. <br> <iframe src="1-1.html" name="1-1-name"></iframe> <br> <iframe src="1-2.html" id="1-2-id" name="1-2-name"></iframe> <br> <iframe src="1-3.html" id="1-3-id"></iframe> <br> </html> </body> </html>