この例では、アラートは空白です。iFrame の場所を読み取りたいのですが、これには object.src を使用していますが、src 属性を設定した場合にのみ機能します。しかし、window.open メソッドを使用して iFrame の場所を設定しましたが、この場合は機能しません。私がやること ?
<body>
<iframe id="location" name="address" style="width:700px; height:700px;">
</iframe>
<script type="text/javascript" language="javascript">
window.open("http://www.google.com","address");
function clickMe()
{
var src = document.getElementBy Id("location").src;
alert(src);
}
</script>
<input type="button" onclick="clickMe()" value="click Me"/>
</body>