[removed]() is not firing with IE 8 in first shot

后端 未结 9 2131

I am trying to make my pages work correctly with IE 8, I found out from here: http://www.masykur.web.id/post/How-to-Make-Our-Website-to-be-Ready-for-IE8.aspx that, my page h

9条回答
  •  粉色の甜心
    2020-12-01 09:45

    I know this is kinda old question, but I just faced the same thing.

     window.onload=function() { alert('hello');};
    

    is treated differently than

     window.onload= new function() { alert('hello');};
    

    The keyword here is new.

    My JS was terminating whenever it reaches (onload=) part until I added the word'new' before 'function'. Even though it worked fine without 'new' in my localhost, but once I put it online, it doesn't work until I add 'new'.

提交回复
热议问题