1.jQuery对象转DOM对象。

jQuery对象转DOM对象有两种方法,[index]和get(index)。

var $cr = $("#cr"); //jQuery对象
var cr1 = $cr[0]; //DOM对象
var cr2 = $cr.get(0);//DOM对象

2.DOM对象转jQuery对象。

用$()把jQuery对象包装起来即可。

var cr = document.getElementById("cr"); //DOM对象
var $cr = $(cr); //jQuery对象

3.null,undefined的区别。

undefined类型只是一个值,即特殊的undefined。在使用var声明变量但未对其加以初始化时,这个变量的值就是undefined。

null类型也是只有一个值的数据类型,这个特殊的值是null。从逻辑学的角度看,null值表示一个空对象指针,用typeof操作符检测null会返回"object"。

上面是定义,区别如下:

  - null是关键字;undefined是Global对象的一个属性
  - null是对象(空对象, 没有任何属性和方法);undefined是undefined类型的值。试试下面的代码:
       document.writeln(typeof null); //return object
       document.writeln(typeof undefined); //return undefined

  - 对象模型中,所有的对象都是Object或其子类的实例,但null对象例外:
       document.writeln(null instanceof Object); //return false

  - null“等值(==)”于undefined,但不“全等值(===)”于undefined:
       document.writeln(null == undefined); //return true
       document.writeln(null === undefined); //return false

  - 运算时null与undefined都可以被类型转换为false,但不等值于false:
       document.writeln(!null, !undefined); //return true,true
       document.writeln(null==false); //return false
       document.writeln(undefined==false); //return false

最新文章

  1. 12/13 Oracle连接报错
  2. jQuery简洁大方的登录页面模板
  3. 《玩转D语言系列》二、D语言现状、基本规定和相关资源介绍
  4. jdk1.8下载安装
  5. Android UI设计中一些不错的示例及第三方控件
  6. SqlServer 不是主键 如何自增
  7. 使用chrome联调不在同一个域的请求
  8. Android 使WebView支持HTML5 Video(全屏)播放的方法
  9. Python 时间 日期常见操作
  10. 一些比较好的shellscript脚本
  11. free命令
  12. WebClient外部请求乱码
  13. Maven详解 之 聚合与继承
  14. 对于利用ica进行fmri激活区识别的理解
  15. web_api vs2015 新加标题无法打开
  16. hadoop学习之hadoop完全分布式集群安装
  17. 在nagios中使用python脚本监控linux主机
  18. 从大数据技术变迁猜一猜AI人工智能的发展
  19. 【python】给正则匹配部分命名
  20. Python自动化编程-树莓派GPIO编程(二)

热门文章

  1. 00051_static关键字
  2. ubuntu添加开机启动
  3. js的undefined怎么判断
  4. HDU——1242Rescue(BFS+优先队列求点图最短路)
  5. POJ 3581 Sequence ——后缀数组 最小表示法
  6. [BZOJ1419] Red is good(期望DP)
  7. 洛谷P2498 [SDOI2012]拯救小云公主 【二分 + 并查集】
  8. sqlite-jdbc
  9. eclipse中AXIS2发布过程
  10. LA 4973异面线段