在这个例子中,alert 是空白的;我想读取 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>