当它尝试使用javascript加载时,在alertbox中返回iframe SRC值



但是它返回空的警告框。谁来帮帮我。我需要alertbox与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>

使用iframe的src属性

alert(oDoc.ifrm.src);

最新更新