对象不支持属性或方法'indexOf'

Abb*_*bas 8 jquery

我使用以下代码:

<html>
<head>
    <title></title>
    <script src="jquery-3.2.0.js"></script>

</head>
<body>
    <script type="text/javascript">
        $(window).load(function () {
            alert('Window loaded');
        });

        $(document).ready(function () {
            alert('DOM Loaded and ready');
        });
    </script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

它如此简单,但我收到了错误

 "Object doesn't support property or method 'indexOf'".
Run Code Online (Sandbox Code Playgroud)

我正在使用Internet Explorer

它是什么原因?

rap*_*aëλ 14

load函数已在1.8中弃用,并在3.0中删除.请改用该on方法

<html>
<head>
    <title></title>
    <script src="https://code.jquery.com/jquery-3.2.0.min.js"></script>

</head>
<body>
    <script>
        $(window).on("load",function () {
            alert('Window loaded');
        });
    </script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

来自https://blog.jquery.com/2016/06/09/jquery-3-0-final-released/

删除了已弃用的事件别名

自jQuery 1.8以来已弃用的.load,.unload和.error已不复存在.使用.on()注册监听器.