jQuery - Object Expected on IE and $(document).ready(function() {});

前端 未结 5 1945
不知归路
不知归路 2021-01-15 19:48

I have a page ([LINK REMOVED]) that works completely well in FireFox and Chrome, but for some reason I am getting an \"Object Expected\" error in most, if not all versions o

相关标签:
5条回答
  • 2021-01-15 19:56

    Your $(document).ready and $(function(){..} methods are just fine - in fact when I fired up the Visual Studio debugger and attached to the page, those methods were firing as expected. The problem is that they are trying to call a function named initializePageMain() that doesn't exist for some reason. As to why that function doesn't seem to exist... I am not sure.

    I would also try "fixing" the script tag that contains this code (sidenote: why isn't doToolTips defined in your index.js file?) to read like the rest of your script tags (get rid of the language element:

    <script type="text/javascript"> ... </script>
    
    0 讨论(0)
  • 2021-01-15 20:13

    Could be the url you're using for jquery.tools. It is missing the http: part.

    //cdn.jquerytools.org/1.2.5/jquery.tools.min.js

    should be

    http://cdn.jquerytools.org/1.2.5/jquery.tools.min.js

    0 讨论(0)
  • 2021-01-15 20:16

    Here's one problem that can cause IE to choke where other browsers may not:

    $('#' + resultDivName).animate({
      height: '300px', // <=== TRAILING COMMA
    }, 500, function() {
      // Animation complete.
    });  
    

    Then, in your qtip call, you have:

    target: 'popPart_WM300BP'
    

    I believe target takes a jQuery DOM object, not a string. DebugBar points to this line as the cause of "object expected".

    Finally, it looks like this version of jQuery Tools includes jQuery 1.4.2. Perhaps 1.4.3 or 1.4.4 would be worth a try.

    0 讨论(0)
  • 2021-01-15 20:17

    If you are testing over a HTTPS connection, check if you are choosing view only the content that was delivered securely. If you choose YES maybe the scripts will not be loaded.

    0 讨论(0)
  • 2021-01-15 20:19

    This is another gem that causes this error in IE

    Math..random();
    

    Those two dots (..) will ruin you.

    0 讨论(0)
提交回复
热议问题