JQuery를 사용하기 위해 바인딩을 가져 오는 데 문제가 있습니다.JQuery를 사용하여 iframe의 onload에 이벤트 핸들러를 바인딩하는 방법은 무엇입니까?
<iframe id="wufooFormz7x3k1" height="281" allowtransparency="true" frameborder="0" scrolling="no" style="width:100%;border:none" src="http://foo111.com"></iframe>
<script>
jQuery('#wufooFormz7x3k1').ready(function()
{
jQuery('#wufooFormz7x3k1').bind('onload', alert('hi1'));
jQuery('#wufooFormz7x3k1').bind('onload', function() { alert('hi2') });
});
</script>
첫 번째 바인드는 경고를 생성하지만이 오류가 발생하고, (I 감지 노력하고있어 임)은 iframe의 후속 부하에 대한 경고를 트리거하지 않습니다.
Uncaught TypeError: Cannot read property 'handler' of undefined and won't be triggered for subsequent onloads.
두 번째 바인딩은 전혀 트리거되지 않습니다.
이상적으로, 내가 원하는 것은 iframe이로드 될 때마다 경고를 생성 할 수 있도록 iframe의 onload에 바인딩하는 것이 이상적입니다.
당신은 신사이고 학자입니다. 고맙습니다! – JeremyB
@JeremyB 그 것을 받아들입니다! 체크 표시를 클릭하여 녹색으로 만드십시오. –