why iframe can't be set onload in IE8

397 Views Asked by At

I try the following code to listen the iframe onload event in IE8

            aliJob.init(data)
            aliJob.openIframe()
            alert(aliJob.ifr)
            if(aliJob.ifr.attachEvent){
                aliJob.ifr.attachEvent('onload',function(){


                    alert("before init")

                    aliJob.ifr.contentWindow.DefaultjobList.jsonInit()


                    aliJob.ifr.contentWindow.document.getElementById("markText").getElementsByTagName("span")[0].onclick=aliJob.closeIframe

                })
            }
            else{
                aliJob.ifr.onload=function(){

                    //some other code


            }

the aliJob.ifr obj is reachable as it can be alert in IE8

However,both of the way can't listener to the iframe onload,

other broswer is fine

Can someone get some ideas of it?

0

There are 0 best solutions below