我绑定如果我通过了jQuery相当于改变像这样为什么windows.onload被执行多次?
// It's a little more complex than this, I analyze if there is any other function
// attached but for the sake of the question it's ok, this behaves the same.
window.onload = myfunction;
的Onload window.onload事件被触发两次我的本地机器上的生产服务器
在几次
$jQuery(window).load(myfunction);
它的行为与预期(只执行一次)。
能不能帮我了解可能的原因它不工作作为第一选择应该?
谢谢!
称为鉴于您的编辑,有没有足够的上下文来猜测为什么该方法会被调用两次的任何可能的原因。请包括任何其他参考加载事件和/或'myfunction'。 – Nicole 2011-06-02 20:07:16
你在这里展示的是完全标准的。我们需要查看代码的其余部分,以查看问题所在。 – squidbe 2011-06-02 20:08:12
@Timmy:看起来你已经“示范”了你的问题。除非你用* actual *代码修改你的问题,否则没有理由保持这种状态。 – Jeremy 2011-06-02 20:12:12