function changeSource() { document.getElementById("frame1").src="//www.w3school.com.cn/example/hdom/frame_c.html" document.getElementById("frame2").src="//www.w3school.com.cn/example/hdom/frame_d.html" }
<iframe src="//www.w3school.com.cn/example/hdom/frame_a.html" id="frame1"></iframe> <iframe src="//www.w3school.com.cn/example/hdom/frame_b.html" id="frame2"></iframe> <br> <br> <input type="button" onclick="changeSource()" value="改变两个框架的 source">