我動態加載內容的成功響應後動態IFRAME內容 - 如何獲得該IFRAME的訪問權限?
<iframe style='border:none;' id='abc' src="http://localhost:39217/Home/GetContent/some_dynamic_code"></iframe>
,在IFRAME是內容
<html>
<head>
<script type="text/javascript">
function onPageLoad() {
if (document.readyState === "complete") {
var cont = document.getElementById("abc");
alert(cont);
}
}
</script>
</head>
<body onload='onPageLoad()'>
<a target="_blank" href='http://lorem'>
<img class='abc' style='max-width:300px; max-height: 38px;' alt='' src='/Images/image.png' />
</a>
</body>
</html>
這iframe
將用我的網站外(用戶)但我希望能夠更改<img>
src
。但是,在更改圖像後,我還需要更改iframe
的width/height
。那麼,如何才能使用JS訪問iframe
?上面的代碼alerts
我null
你設置一個類和搜索ID .. – EricG