Javascript 捕捉按钮单击Iframe内的事件-角度
上述代码的问题是,如果按钮加载稍微晚了一点,它就不起作用或者如果iframe中的按钮位于其他选项卡中,请提供一把小提琴来重现您的问题,我希望这会有所帮助Javascript 捕捉按钮单击Iframe内的事件-角度,javascript,angularjs,Javascript,Angularjs,上述代码的问题是,如果按钮加载稍微晚了一点,它就不起作用或者如果iframe中的按钮位于其他选项卡中,请提供一把小提琴来重现您的问题,我希望这会有所帮助 <button class="btn btn-default" ng-click="openModal()">Open Iframe</button> <div id="omniScriptModal" class="modal"> <div class="iframe-close" ng-c
<button class="btn btn-default" ng-click="openModal()">Open Iframe</button>
<div id="omniScriptModal" class="modal">
<div class="iframe-close" ng-click="closeModal()">Close</div>
<iframe id="omniScriptIFrameModal" frameborder="0" allowfullscreen
src="ExternalLink"></iframe>
</div>
$scope.openModal = function(){
document.getElementById('omniScriptModal').style.zIndex = 1040;
var buttonComponent = document.getElementById('omniScriptIFrameModal').contentWindow.document.getElementById('IdentifyCaller_nextBtn');
buttonComponent.onclick = function ($scope) {
document.getElementById('omniScriptModal').style.zIndex = -1;
}
}