我如何实现一个事件函数,该函数会触发来自<iframe>
文档元素的点击事件。
我必须采取行动document.getElementById("iframe-id").contentWindow.window.document.getElementById("hello-abc")
。
是否可以使用 Backbone.View() 来实现?
<!-- Sample example -->
<html>
<head></head>
<!-- parent #document -->
<body>
<div class="height-inherit">
<div id="pdf-overlay" class="modal fade in" data-replace="true" aria-hidden="false" data-keyboard="false" style="overflow-y: hidden !important; display: block;">
<div class="modal-dialog">
<div class="modal-body">
<!-- this id =pdf could access from parent document-->
<iframe id="pdf" width="100%" scrolling="no" tabindex="0" vspace="0" class="" allowtransparency="true" aria-hidden="true" frameborder="0" hspace="0" marginheight="0" marginwidth="0" height="621" src="/static/lib/pdfjs/web/viewer.html?file=/static/app/abc.pdf">
<!-- child #document -->
<html>
<head></head>
<body>
<div>
<!-- I have to impelemt in parent view(.js) on listen from child window document element tiggered event -->
<button id="hello-abc" data-l10n-id="error_close" style="margin-top:5px;">Close</button>
</div>
</body>
</html>
</iframe>
</div>
</div>
</div>
</div>
</body>
</html>