Tag:js

  • Learning regular expressions (JS, c)

    Time:2020-1-11

    Using regular expressions in JS function myValid() { var errorMsg = “”; var res = true; //Get the value to verify Var receivename = $(“#receivename”). Val(); // name Var receivemobile = $(“ාtmobile”). Val(); // mobile number Var validcode = $(“#validcode”). Val(); // verification code Var regname = / ^ [\ u4e00 – \ u9fa5] {2,4} […]

  • A code of downloading progress bar and playing progress bar in JS

    Time:2020-1-8

    It’s not too difficult technically. What’s the difficulty is how to make the whole animation smooth. One of the main problems is the lag of animation: when the download progress reaches a certain point, you use 250ms of animation to transition to the past, which is already slow, so many people may not do animation […]

  • Base 64 coding and decoding implemented by JS

    Time:2019-12-24

    Base64 is a representation of binary data based on 64 printable characters. Since the 6th power of 2 is equal to 64, every 6 bits is a unit, corresponding to a printable character. Base64 is often used to represent, transfer and store some binary data when dealing with text data. Including mime email, email via […]

  • Key points of JavaScript querying data in mongodb by date

    Time:2019-12-23

    Group by date aggregate query date statistics daily data (amount of information) 1  { “_id” : ObjectId(“557ac1e2153c43c320393d9d”), “msgType” : “text”, “sendTime” : ISODate(“2015-06-12T11:26:26.000Z”) }   2  { “_id” : ObjectId(“557ac1ee153c43c320393d9e”), “msgType” : “text”, “sendTime” : ISODate(“2015-06-12T11:26:38.000Z”) }   3  { “_id” : ObjectId(“557ac2012de5d32d213963b5”), “msgType” : “text”, “sendTime” : ISODate(“2015-06-12T11:26:56.000Z”) }   4   { “_id” : […]

  • JS implementation Click to generate UUID method complete example [based on jQuery]

    Time:2019-12-14

    The example of this paper describes the method of generating UUID by clicking in JS. To share with you for your reference, as follows: <!DOCTYPE html> <html lang=”en”> <head> <meta charset=”UTF-8″> < title > www.jb51.net method instance of generating UUID with JS < / Title > <script src=”http://libs.baidu.com/jquery/2.0.0/jquery.min.js”></script> <script> var id = getUuid(); $(document).ready(function() { […]

  • JS uses cookies to remember user names

    Time:2019-12-8

    The example of this article describes how JS uses cookies to remember user names. To share with you for your reference, as follows: <!DOCTYPE html> <html> <head> <meta charset=”utf-8″> <meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1″> < title > www.jb51.net cookie remember user name < / Title > <meta name=”description” content=””> <meta name=”keywords” content=””> </head> <body> <script> //1. Use […]

  • PHP VBS JS function comparison table

    Time:2019-11-27

    For various languages, functions and definition methods, you can distinguish them and use later learning applications.Due to limited space, full address:http://demo.jb51.net/chengxu/aspphpjs.html

  • Merge, compress and cache management of JS and CSS in high performance web development

    Time:2019-11-21

    Problems: There are two main problems in merging and compressing files:1. Each time you publish, you need to run your own bat file or other programs to merge and compress the files according to your own configuration.2. Because the files that need to be loaded in the production environment and development environment are different, the […]

  • Interaction and precautions between data – * and JS / jquery

    Time:2019-11-17

    HTML5 new attribute data-* Writing examples <div data-role=”page” data-last-value=”43″ data-hidden=”true” data-options='{“name”:”John”}’> </div> 1. definition: The data – * property is used to store private custom data for a page or application. The data – * attribute gives us the ability to embed custom data attributes on all HTML elements. 2. Notes: The data – * […]

  • JavaScript judges whether there is instance code in the file

    Time:2019-11-17

    JavaScript determines whether the file exists 1. Client <script language=”javascript”> function FileExist() {   var sfso=new ActiveXObject(“Scripting.FileSystemObject”);   var fPath=”[The path of the file]”;   if(sfso.FileExists(fPath))   {   alert(“Exist”);   }   else   {     alert(“Doesn’t exist”);  } } </script> 2. Server side <script language=”javascript”> function FileExist() {   var xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”);   xmlhttp.open(“GET”,FileURL,false); xmlhttp.send(); if(xmlhttp.readyState==4)   {   if(xmlhttp.status==200) alert(“Exist”);   else if(xmlhttp.status==404) alert(“Doesn’t exist”); […]

  • Judge that two object fields are the same through JS depth

    Time:2019-11-13

    Code: /** *Determine whether this object is of object type * @param {Object} obj */ function isObject(obj){ return Object.prototype.toString.call(obj)==='[object Object]’; }; /** *Determine whether this type is array type * @param {Array} arr */ function isArray(arr){ return Object.prototype.toString.call(arr)==='[object Array]’; }; /** *Depth compares whether two objects are the same * @param {Object} oldData * @param […]

  • JS regular expression must contain numbers, letters, special characters

    Time:2019-11-13

    Let’s introduce that JS regular expressions must contain numbers, letters and special characters JS regular expression requirements: 1. It must contain numbers, English letters, special symbols and be greater than or equal to 8 digits 2. Special symbols include: ~! @ × $%^&* The regular expression is as follows: /^(?=.*\d)(?=.*[a-zA-Z])(?=.*[[email protected]#$%^&*])[\[email protected]#$%^&*]{8,}$/ Interpretation: Here we mainly use […]