zoukankan      html  css  js  c++  java
  • you might not need jquery

    What's the oldest version of IE you need to support? IE10

     1 /**json**/
     2 var request = new XMLHttpRequest();
     3 request.open('GET', '/my/url', true);
     4 
     5 request.onload = function() {
     6   if (this.status >= 200 && this.status < 400) {
     7     // Success!
     8     var data = JSON.parse(this.response);
     9   } else {
    10     // We reached our target server, but it returned an error
    11 
    12   }
    13 };
    14 
    15 request.onerror = function() {
    16   // There was a connection error of some sort
    17 };
    18 
    19 request.send();
     1 /**request**/
     2 var request = new XMLHttpRequest();
     3 request.open('GET', '/my/url', true);
     4 
     5 request.onload = function() {
     6   if (this.status >= 200 && this.status < 400) {
     7     // Success!
     8     var resp = this.response;
     9   } else {
    10     // We reached our target server, but it returned an error
    11 
    12   }
    13 };
    14 
    15 request.onerror = function() {
    16   // There was a connection error of some sort
    17 };
    18 
    19 request.send();
    1 /**post**/
    2 var request = new XMLHttpRequest();
    3 request.open('POST', '/my/url', true);
    4 request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
    5 request.send(data);
    /**hide**/
    el.style.display = 'none';
     1 /**fade in**/
     2 /**javascript**/
     3 <script>
     4     el.classList.add('show');
     5     el.classList.remove('hide');
     6 </script>
     7 <style>
     8     .show {
     9       transition: opacity 400ms;
    10     }
    11     .hide {
    12       opacity: 0;
    13     }
    14 </style>
    /**show**/
    el.style.display = '';
    /**add class**/
    el.classList.add(className);
    /**after**/
    el.insertAdjacentHTML('afterend', htmlString);
    /**append**/
    parent.appendChild(el);
    /**before**/
    el.insertAdjacentHTML('beforebegin', htmlString);
    /**clone**/
    el.cloneNode(true);
    /**contains**/
    el !== child && el.contains(child);
    /**children**/
    el.children
    /**Contains Selector**/
    el.querySelector(selector) !== null
    /**Each**/
    var elements = document.querySelectorAll(selector);
    Array.prototype.forEach.call(elements, function(el, i){
    
    });
    /**Empty**/
    el.innerHTML = '';
    业精于勤荒于嬉,行成于思毁于随
  • 相关阅读:
    班别:批量添加导师
    批量删除注入字段,触发器防止注入。
    c#生成不重复随机数
    网络蜘蛛爬虫程序
    session丢失问题整理
    asp.net 自动生成控件
    C#实现所有经典排序算法 收藏
    泛型学习
    Android 判断网络并打开设置界面
    Android 获取Android手机中SD卡存储信息 获取剩余空间
  • 原文地址:https://www.cnblogs.com/qixianchuan/p/11308792.html
Copyright © 2011-2022 走看看