The code is as follows
Copy Code
/** Base64 Code*/var base64encodechars = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/";var base64decodechars = new Array (-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
In recent projects, a variety of information is often required to format validation, of course, the most common is through the regular expression of validation,
In your previous blog, you found a way to do the following:
Mailbox format is not
Example
The code is as follows
Copy Code
/*** Implementation subclass inherits the parent class, but does not produce redundant properties and methods* @returns {Function}*/Define (function () {return function (subtype,
In JavaScript, creating an array can use the array constructor, or use the array direct amount [], which is the preferred method. The array object inherits from the Object.prototype, and the array performs the typeof operator to return object
In JavaScript, instantiating an object uses the New keyword.
People often ask me when to use the New keyword for a function.
Before you answer this question, you need to understand the nature of new and what the new action does when invoking the
Anonymous functions are functions that have no names, and closures are functions that can access variables in a function's scope.
A anonymous functions
The code is as follows
Copy Code
normal functionfunction box ()
Many of the frameworks have a parent-child relationship that is cumbersome to operate, and many students often have this sad code:
The code is as follows
Copy Code
Window.parent.document.getElementById ("main").
1, get the current JS file path in jquery
In jquery to get the current JS file path is relatively simple, only need the following line of code to be done.
var __file__ = $ ("script"). Last (). attr ("src");
Note that we typically place this line
Error prompted unterminated string literal, mainly because the output in JS contains N. The solution is to first take the data in the following way to remove N, and then pass the value of JS.
The code is as follows
Copy Code
Format is day/month/year
The code is as follows
Copy Code
Date format[' Date_au ', function (v) {if (vanadium.validators_types[' empty '].test (v)) return true;var regex =/^ (d{2})/(D{2})/(d{4}) $/;if (!regex.test (v))
Similarly, we can imagine that the 1/3 result should be 0.3333333333333333.To get the results we want, we need to correct this value.
In JS, the parsefloat function can be used to convert strings into floating-point numbers. We can use the parseint
Number.tofixed (x) is the x bit after the specified number is intercepted, and number.toprecision (x) intercepts the entire number to the specified (x) length. Note that one calculates the length of the decimal point, and one is the length of the
A value that takes a parameter from a URL without having to loop purely with a regular implementation. The core technique for replacing loops is that the replace () method of a string can be used as a second parameter and replaced by a user-defined
Web page Effects subString () method and slice () method
The slice () method extracts a part of the string and returns the extracted part with a new string.GrammarStringobject.slice (Start,end)Parameter descriptionThe starting subscript of the
A few days ago, the project has a function and a treasure shopping to pay the password of the input box a bit similar, wrote this blog, right when the summary notes.
?? Kidnap policeman was stationed soy play with benzene by washing
The code is as follows
Copy Code
document.getElementById (' intro '). Style.color = ' #FF0000 ';
In order to understand the functionality of this API, it is easy to understand that by looking at it from one step to the next:
Tip: you can modify some code before running Customer service of a website that is fixed on the right of the webpage与之间-->与之间-->Our business hoursAM-AMQq consultationMsn consultationWangwang onlineTel: 010-88888888 Tip: you can modify some code
SetTimeout ()SetTimeout () is the method of window, but we all skip the top-level object name of window. This is used to set a time. When the time is reached, a specified method will be executed. Let's take a look at the next simple example. This is
Calendar-Converter is a simple plug-in that may only be used by Chinese applications or websites. The plug-in function is to convert the date and time between the Gregorian Calendar and the lunar Calendar.ExampleFirst introduce the plug-in fileThen
Number () is used to convert numbers, String () is used to convert strings, and Boolean () is used to convert Boolean values.JavaScript data typeThere are five data types that can hold values in JavaScript:· String· Number· Boolean· Object·
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service