zoukankan      html  css  js  c++  java
  • jQuery入口函数测试

    <script src="js/jquery-1.12.4.js"></script>
    <
    script> window.onload = function (ev) { /* jQ入口函数传入不同参数得到的实例 1.传入 '' null undefined NaN 0 false 2.传入html片段 3.传入选择器 4.传入数组 5.传入伪数组 6.传入对象 7.传入DOM元素 8.传入基本数据类型 */ // 1.传入 '' null undefined NaN 0 false // 会返回一个空的jQuery console.log($()); console.log($('')); console.log($(null)); console.log($(undefined)); console.log($(NaN)); console.log($(0)); console.log($(false));    // 2.传入html片段 // 会将创建好的DOM元素存储到jQuery对象中返回 console.log($('<p>1</p><p>2</p><p>3</p>'));        // 3.传入选择器 // 会将找到的所有元素存储到jQuery对象中返回 console.log($('li'));       // 4.传入数组 // 将数组中存储的元素一次存储到jQuery对象中并返回 console.log($([1, 2, 3, 4, 5, 6])); // 5.传入伪数组 // 将数组中存储的元素一次存储到jQuery对象中并返回 var likeArr = {0:"lnj", 1:"33", 2:"male", length:3}; console.log($(likeArr));        // 6.传入对象 // 会将传入的对象存储到jQuery对象中返回 function Person(){ } console.log($(new Person())); // 7.传入DOM元素 // 会将传入的Dom元素存储到jQuery对象中返回 console.log($(document.createElement('div')));        // 8.传入基本数据类型 console.log($(123)); console.log($(true)); /* 1.传入 '' null undefined NaN 0 false, 返回空的jQuery对象 2.字符串: 代码片段:会将创建好的DOM元素存储到jQuery对象中返回 选择器: 会将找到的所有元素存储到jQuery对象中返回 3.数组: 会将数组中存储的元素依次存储到jQuery对象中立返回 4.除上述类型以外的: 会将传入的数据存储到jQuery对象中返回 */ } </script>
     
    不考虑业务场景,一味的争执技术的高下,都是耍流氓。
  • 相关阅读:
    groovy集合
    groovy函数、字符串、循环
    groovy运行程序和类型推断
    常见IT英语短语一
    常见IT英语单词
    认识Groovy
    maven入门
    springboot之内嵌tomcat修改端口号
    springboot手动配置数据源:
    img与父元素的间隙解决
  • 原文地址:https://www.cnblogs.com/leoych/p/14853425.html
Copyright © 2011-2022 走看看