0

但它返回空警报框..请任何人帮助我。 我需要带有 iframe src(地址位置,http://www.google.com)值详细信息的警报框。

<iframe width="700px" height="900px" name="ifrm" id="ifrm" onload="load()"></iframe> 

<script type="text/javascript">
function load()
{
var oIframe = document.getElementById("ifrm");

var oDoc = oIframe.contentWindow || oIframe.contentDocument;

if (oDoc.document) {

    oDoc = oDoc.document;
}
alert(oDoc.ifrm.href);
}
</script>
4

1 回答 1

0

使用 iframe 的 src 属性

alert(oDoc.ifrm.src);
于 2013-03-08T07:47:04.933 回答