Recently looking at "JavaScript data structure and algorithms" This book, to fill the data structure and algorithm part of the knowledge, feel that this piece is a short plate.
List : stores an ordered set of elements, but unlike arrays, the
1.js Regular Expression (RegExp object)
The RegExp object has 3 methods: Test (), exec (), and compile ().
①test () method
The test () method retrieves the specified value from the string. The return value is true or false.
var patt1=new RegExp ("E")
1
Copy Code code as follows:
Write HTML content in page
document.write ("hello world!")
2
Copy Code code as follows:
To prevent browsers that do not support JavaScript to display JS as the content of the page
To get the CSS size of an element
1. Get the size of an element through the style inline
Copy Code code as follows:
var box = document.getElementById (' box '); Get the element;
Box.style.width; 200px;
Box.style.height; 200px;
A table of operations
The tag is one of the most complex structures in HTML, and we can create it by using the DOM, or htmldom to manipulate it;
Use DOM to create tables;
var table = document.createelement (' table ');
Table.border = 1;
The ECMAScript variable contains values of two different data types: the base type value and the reference type value. The base type value is a simple data segment, whereas a reference type value refers to objects that may be composed of multiple
Introduced
This article mainly introduces the pattern of creating objects, using a variety of techniques to greatly avoid errors or to write very concise code.
Mode 1: Namespace (namespace)
Namespaces can reduce the number of global naming needs
Introduced
Adapter mode (Adapter) is the transformation of an interface (a method or a property) of a Class (object) into another interface (method or property) that the customer wishes, and the adapter pattern makes it possible for those classes
1. What is the data type?
Most of the programming languages we touch, the data are classified, including numbers, characters, logic True and false: Int,long,string,boolean .... And so on; we all know that computers are used in binary mode for data
Bricks and mortar, and then the wall, in the ECMAScript, the sentence is the walls we need to build. Statements and operators like, for people with a C background, it is natural, the following similar form to organize the relevant knowledge of the
ToFixed () method specifies the number of decimal places
The Toexponential () method represents the number with scientific notation, and the parameter specifies the number of decimal places.
The Toprecision () method automatically judges the call to
The front end of a website is composed of three layers. A layer of architecture built by XHTML that includes structured and semantically labeled tags, as well as the content of a Web site. You can add a presentation layer (CSS) and a Behavior layer (
The example in this article describes the method that JavaScript custom function implements to find the longest common substring of two strings. Share to everyone for your reference, specific as follows:
Finds the longest common substring of
Here we discuss the relationship between the internal prototype (__PROTO__) of the object and the prototype (prototype) of the constructor.
__proto__ of all constructors/functions point to Function.prototype, which is an empty function (Empty
One, case sensitive
Everything in ECMAScript (variables, function names, operators) is case-sensitive.
If the variable name test and test represent two different variables,
Second, identifiers
An identifier is the name of a variable, function,
A function is a statement that can be run at any time, simply put, a function is a set of statements that completes a function, and it accepts 0 or more parameters.
the basic syntax for a function is as follows
Copy Code code as follows:
Object Properties
Copy Code code as follows:
Document.title//Set document title equivalent to HTML label
Document.bgcolor//Set page background color
Document.fgcolor//Set foreground colors (text color)
Pass the function as a parameter into another function. This function is called a callback function.
It is often the case that the layer A and B of a project are coordinated by different people. Layer A is responsible for the function funa,b layer
There are a number of ways to define classes in JS:
1. Factory mode
Copy Code code as follows:
function car () {
var ocar = new Object;
Ocar.color = "Blue";
Ocar.doors = 4;
Ocar.showcolor = function () {
document.write
Use uploadify to realize file upload can client judge file size, control file upload type, achieve multiple file upload, display progress bar and other functions, easy to use, good compatibility.
This example is the integration of DWZ uploadify
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