在我的静态HTML页面中,我无法使用Jquery。我希望有一个按钮可以在iframe中加载网页。
<input type="button" value="See" id="but" onclick="document.getElementById('iframe').innerHTML='Hello'"/>
<iframe id="iframe" name="myIframe" width="90%" height="90%"></iframe>
没有任何反应。
iframe有来源,而不是innerHtml
document.getElementById('but').addEventListener('click', function() {
document.getElementById('iframe').src = "data:text/html;charset=utf-8," + escape('Hello')
})
<input type="button" value="See" id="but" />
<iframe id="iframe" name="myIframe" width="90%" height="90%"></iframe>