菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>小鸟启蒙(facesoho.com)</title> </head> <body> <p>在页面中查找所有框架的数量,然后修改 iframe 元素的 src 属性为 "http://www.facesoho.com":</p> <button onclick="myFunction()">点我</button> <br><br> <iframe src="https://www.baidu.com"></iframe> <iframe src="https://www.taobao.com"></iframe> <iframe src="http://c.facesoho.com"></iframe> <script> function myFunction() { var frames = window.frames; var i; for (i = 0; i < frames.length; i++) { frames[i].location = "http://www.facesoho.com"; } } </script> </body> </html>
运行结果