加载页面时这些标准方式调用函数的方式有什么区别?
这三种通常调用函数的方式有什么区别? 到处搜索,发现了每个人的单一解释,但没有比较所有这三个与彼此相关的解释。这三个如何比较?
A.window.onload = lunchgallery();
B.$(function(){laundinggallery();}
C.$(window).on('load',function(){laundinggallery();});
如果还有其他标准方法欢迎添加并使比较更全面
我是我意识到$(document).ready(function(){});
仅适用于jQuery函数。然而,这个问题的范围是针对一般,标准的,非框架的依赖的JavaScript方法,即在pageload或pageload期间或之后或在网页的使用寿命中调用一个函数的方式)。
Whats the difference between these three ways of normally calling a function?
Searched everywhere and found single explanations of each, but not in a comparison of all these three relatieve to eachother. How do these three compare?
A.window.onload = LaunchGallery();
B.$(function(){LaunchGallery();}
C.$(window).on('load', function() {LaunchGallery();});
If there are other standard ways welcome to add and make the comparison more comprehensive
I'm aware that the $(document).ready(function(){});
is for JQuery functions only. The scope of this question however is for general, standard, non framework dependant Javascript ways of calling a function into existence during, at or after pageload or any other moment during the lifespan of a webpage).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论