the location of the label If the page requires a lot of JavaScript code, this will undoubtedly cause the browser to have a noticeable delay in rendering the page, while the browser window in the delay period will be blank. To avoid this problem, modern WEB applications typically place all JavaScript references behind the page content in the DOCTYPE HTML>HTML>Head>title>Example HTML Pagetitle>Head>Body>her
extensions:A) popup The function of the new browser window;b) The ability to move, zoom, and close the browser window;c) Navigator object that provides browser details;d) A Location object that provides detailed information about the pages loaded by the browser;e) A Screen object that provides detailed information about the user's display resolution;f) support for cookies;g) Custom objects such as the activexobject of XMLHttpRequest and IE.6, BOM no standard can be followed, so each browser has
In the beginning of the advent of JavaScript, no one will think it will be applied so widely, but also far more complex than most people imagine, in the process of my own learning, there have been many shocks, but often not long, a lot of beautiful use is blurred again, I hope that through the JavaScript Advanced Programming (3rd
Seldom read, do not like to read, the main school is always sitting, not much qualitative, a book can be read two days, casually turn over, you can also throw in the corner for a few months not to move.The last time I met the JavaScript Advanced Programming (3rd edition), it felt really good, and many great gods were recommending this book, so they downloaded the
example from the JavaScript Advanced Programming (3rd Edition) to understand:
Copy Code code as follows:
Go to global scope, create global variable Object
var color = "Blue";
function ChangeColor () {
Go to ChangeColor scope, create changecolor corresponding variable object
var anothercolor = "Red";
function Swapcolors (Color1,
can be a variable, or even an expression. The switch statement uses the strict equality operator when comparing values, so type conversions do not occur.
Any function can implement the return value at any time by the return statement followed by the value to be returned, and any code after the return statement will never be executed.
Strict mode has some limitations on functions:
The function cannot be named eval or arguments;The parameter cannot be named eval or arguments;Two name
the array item, the position of the item in the array, the array object itselfL every (): Runs the given function for each item in the array, and returns True if the function returns true for each itemL filter (): An array of items that run the given function for each item in the array, returning the function that returns trueL ForEach (): Runs the given function for each item in the array, this method does not return a valueL map (): Each item in an array runs the given function, returning an
One1. Get formvar form = Document.queryselector (' #formId '); var form = document.forms["FormName"];2.button:submit commits and Form.submit () submissions in JavaScript code the subtle differences3. Two ways of repeating a formDisable the Submit button after the first time the form is submitted, or cancel subsequent form submission actions in the onsubmit handler (how do I cancel the doubt?). )。JavaScript
(Uniform Resource Identifiers, Universal Resource Identifiers) to be sent to the browser. where encodeURI () is used primarily for the entire URI, and encodeURIComponent () is used primarily to encode a segment of the URI. The difference is that encodeURI () does not encode special characters that are themselves URIs, such as colons, forward slashes, question marks, and well sizes, while encodeuricomponent () encodes any non-standard characters it discovers. The two methods corresponding to enc
regular expressions defined in literal form/* * Match all ". At", case insensitive */ var pattern4 =/\.at/gi;002 RegExp constructor to create a regular expression/* * Same as PATTERN1, but created using the constructor function */ var New RegExp ("[Bc]at", "I");ECMAScript 5 explicitly stipulates that the use of regular expression literals must be the same as calling the RegExp constructor directly, each time creating anCreate a new RegExp instance.5.5 Function typeThe function is actually an ob
method is actually a property, Just the value type of the attribute is a function, we also call it a method:
Category
Properties/Methods
Description
Property
Constructor
Point to the function used to create the current object
Method
hasOwnProperty (PropertyName)
Checks whether the given property is in the current object instance
propertyIsEnumerable (PropertyName)
Checks whether a given property can be enumerated by
best-selling Ajax advanced programming.[1]Directory editing 1th chapter JavaScript What is 1.1 history brief 1.2 JavaScript Implementation 1.3 Summary 2nd Chapter ECMAScript Foundation. 2.1 Syntax 2.2 variable 2.3 keyword 2.4 reserved word 2.5 original value and reference value 2.6 original Type 2.7 Conversion 2.8 Reference type 2.9 operator 2.10 Statement 2.11 Function 2.12 Summary
From last year, because it is too long, there is always no way to read it, plus it and the second version of the majority of the same, read more interested in a little bit.Compared with the second version, its biggest change is to add a lot of HTML5 content, such as: Something new Object objects, data properties, accessor properties and some corresponding methods, such as its comparison and summary of common cross-domain methods: POSTMESSAGE,IE8 XDR, upgraded XHR, JSONP cross-domain principle, o
()-start);
};
Test (10);//55,2,55,2
Test (20);//6765,1,6765,7
Test (30);//832040,2,832040,643
As you can see, the greater the N value, the more obvious the advantage of using caching calculations. As an exercise, you can try to modify the function of calculating the factorial yourself.
(3) Mimic block-level scopes
In ECMAScript, there are statement blocks, but there are no corresponding block-level scopes, but we can use closures to mimic block-level scopes, in general format:
2017-05-10JS IntroductionInvented by a man named "Not hard to be". The popularity of JS is due to the relationship between Ajax.JS is divided into three parts:
Core: ECMAScript
Document Object Model: DOM
Browser Object Model: BOM
Core: ECMAScriptHe has nothing to do with the browser, just the syntax, the type, the keywords or something.Document Object Model: DOMDom is to think of HTML as a tree structure so that you can manipulate them through the API.Html:html> head> t
value (or pointer), the reference point to the object is not involved in replication, That means the last two reference variables point to the same object5. Each execution environment has a variable object associated with it, and all variables and functions defined in the environment are stored in the object. There are many kinds of execution environment, such as global environment, function environment, with environment, and so on, the variable objects of these environments form the scope chai
the formal parameters synchronously Para1
Console.info (Arguments[1]);//-1
Para2 = 2;
Console.info (Arguments[1]);//2, modify the formal parameter para2, will be synchronized modify ARGUMENTS[1]
Console.info (PARA3);//undefined, the formal parameter not passed in the actual parameter is undefined
ARGUMENTS[2] = 3;
Console.info (arguments[2]);//3
Console.info (PARA3);//undefined, formal parameters that do not accept actual arguments do not have a sync relationship
Console.info (Arg
() {Return age + Run ();}};}();The above example of a direct return object can also be written like this:var box = function () {var age = 100;Function Run () {Return ' running ... ';}var obj = {// Create literal objectGo:function () {Return age + Run ();}};Return obj; return This object}();The literal object declaration, in fact, can be regarded as a singleton pattern in the design pattern, so-called singleton mode, which is always an instance of preserving the Object.Enhanced module mode, whic
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.