<html>
<body>
<h1>Window 对象</h1>
<h2>frameElement 属性</h2>
<p>请点击按钮。</p>
<p>如果窗口位于框架中,请将其 URL 更改为 "w3school.com.cn"。</p>
<button onclick="myFunction()">试一试</button>
<script>
function myFunction() {
const frame = window.frameElement;
if (frame) {
frame.src = "https://www.w3school.com.cn/";
}
}
</script>
</body>
</html>