<html>
<body>
<h3>如何访问 IFRAME 元素的演示</h3>
<iframe id="myFrame" src="/index.html"></iframe>
<p>单击按钮以获取 iframe 的 URL。</p>
<button onclick="myFunction()">试一试</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myFrame").src;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>