js基础
来源:互联网 发布:织梦cms 地区分站 编辑:程序博客网 时间:2024/06/10 02:02
一般情况先一个页面响应加载的顺序是:域名解析-加载html-加载js和css-加载图片等其他信息。
$(function(){})和$(document).ready(function(){})document.ready和onload的区别
1.
ready:文档结构已经加载完成(不包含图片等非文字媒体文件)
onload:所有元素都加载完成。
2.
JavaScript的onload事件一次只能保存对一个函数的引用,会自动用最后面的函数覆盖前面的函数,
而ready不是
<script> function a(){alert(this.name); } function b(){var name='b'; } // 执行a,a中的this对象为b a.call(b); </script>
=========================================================================================
jQuery插件定义方法
一. jQuery对象添加新方法
1.
$.fn.myfunction=function(){};2.
jQuery.fn.extend({myfunction:function(){alert($(this).val());}});
二. jQuery类添加新方法
1.jQuery.myfunction=function(){};2.
jQuery.extend({myfunction:function(){alert($(this).val());}});
例子:
(function($){$.fn.test11=function(){alert($(this).text());}$.fn.extend({test12:function(){alert($(this).text());}})$.test21=function(){alert('test21');}$.test22=function(){alert('test22');}})(jQuery);<script>$(function(){$("#id11").test11();$("#id12").test12();$.test21();$.test22();})</script><div><p id="id11">this is id11</p><p id="id12">this is id12</p><p id="id21">this is id21</p><p id="id22">this is id22</p></div>
===================================================================================================================================
遍历:http://www.cnblogs.com/xhy-steve/p/5618441.html
===================================================================================================================================
将函数声明转化为函数表达式的3种方法:
+function () { };(function () {});void function() {};+ - ! function($) (), function 前面的符号意思
======================================================================================================================================
use strict
JavaScript 严格模式(use strict)
===================================================================================================================================
参考:call
===================================================================================================================================
构造函数:http://www.ruanyifeng.com/blog/2010/05/object-oriented_javascript_inheritance.html
===================================================================================================================================
Array.prototype.slice.call(arguments)
- js基础
- js基础
- js基础
- js基础
- JS基础
- js基础
- js基础
- JS基础
- js基础
- js基础
- js基础
- js基础
- JS基础
- js 基础
- js-基础
- js基础
- js基础
- js基础
- dubbo使用1
- java基础------continue和break的区别
- 当知识图谱“遇见”深度学习
- netty私有协议的开发
- Android\sdk\build-tools\21.1.2\aapt.exe'' finished with non- zero exit value 1 问题的解决办法
- js基础
- GalaxyOJ-858 (tag线段树)
- 基本的java加密算法MD5等等
- HDU-5556 Land of Farms(无向图的最大独立集)
- bat 文件、文件夹的复制
- Apache/Tomcat/JBOSS/Neginx/lighttpd/Jetty常见服务器的区别比较
- curl常用命令
- C#开发-FTP操作方法整理 2--C# FTP操作类
- 史上最全最详细的Spring定时任务的讲解以及实例