IE中的$(window).load()? [英] $(window).load() in IE?

查看:144
本文介绍了IE中的$(window).load()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我遇到了一个神秘的问题,IE(6-8)一直在给我一个错误。我不知道这是不是问题,但我认为是。

Recently I ran into a mysterious problem that IE (6-8) is keeping throwing me an error. I don't know if this is the problem, but I think it is.

jQuery包含网站,输入

$(window).load(function(){
     alert("Wont able to see me");
});

并且会弹出一个错误:


无法获取属性'slice'的值:object为null或undefined

"Unable to get value of the property 'slice': object is null or undefined"

我有没有做错什么或其他什么???

Did I do anything wrong, or anything else???

推荐答案

IE10和IE9的最新jQuery(1.7.1)不会产生对我来说这样的错误。

The latest jQuery (1.7.1) with IE10 and IE9 does not produce such an error for me.

作为旁注; 如果您希望在dom准备就绪时执行某些操作;
试试这种方式;

As a side note; If you wish to execute something when the dom is ready; Try this way;

$(function(){
     alert("Wont able to see me");
});

我相信这是将函数附加到domready事件的标准约定。

I believe this is the standard convention for attaching a function to domready event.

参考: jQuery文档

这篇关于IE中的$(window).load()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆