JS BasicsGrammar' Use strict ' (strict mode)Defining variablesvar object; Declare unassigned only, default value is undefined;var object1= value; Declare and assign value;function Fun (a) {This is also called a local variablevar obj=[] This is called a local variable and cannot be called in the outer body of the functionObjct1=[] is called a global variable, which can be used when the function name is called once.}Multi-variable definitionvar a,b,cx=1
The JS keyboard control event tutorial obtains keyboard control events, which is one of the most interactive methods. The first thing you need to know is how to initialize the event. The basic statement is as follows: document. onkeydown = keydown when the browser reads this statement, it calls the keydown () function no matter which key is pressed on the keyboard. Capturing Keyboard Events is a little diff
As we all know, jQuery is now very popular, and jQuery has already been used on Baidu's new homepage. Today we will summarize how to write better jQuery code to make jQuery Code better and faster to execute, I hope this jQuery tutorial will change your previous unreasonable practices.
1. Correctly reference jQuery1. Try to introduce jQuery before the body ends, rather than in the head.2. Use a third-party CDN to introduce jQuery. Note that when a pro
I. Methods of UseThe HTML structure of the canvas plugin is very simple, which is to use a tag:You can then invoke the plug-in using the following method:function init () {document.getElementById (' Portrait-image '). Closepixelate ([{resolution:24},{shape: ' Circle ', resolution:24, Size:16, Offset:12, alpha:0.5}]);};Window.addeventlistener (' Load ', init, false);Second, the structure function and the methodvar Img=document.getelementbyid (' portrait-img ');var mypixelation=new closepixelatio
Original addressWe learned about the creation of maps and markers in the front. So today we're going to learn how to display a window on a map (Infowindow)The Infowindow constructor is:Infowindow (opts?:infowindowoptions). The infowindowoptions Object Specifies the initialization parameters that are used to display the information window. Infowindowoptions Object Properties:content: contains a text string or displays a DOM node in the Information window. Pixeloffset: represents the position offs
Transferred from: http://blog.csdn.net/lulei9876/article/details/8494337When self-study jquery, saw an English word (Callback), immediately back faint cold sweat. Google quickly found that the original Chinese translation into a callback. That is, the callback function. Do not understand Ah, so in the Google callback function, found that the online Chinese interpretation is too "abstruse", I admit that I caishuxueqian. After looking at some examples of callbacks, it seems a bit understandable. H
(‘false‘); // true! ‘false‘字符串转换结果为true!因为它是非空字符串!var b3 = Boolean(‘‘); // falsevar s = String(123.45); // ‘123.45‘typeof s; // ‘string‘Did you feel a big head? This is the hypnotic charm peculiar to JavaScript!To summarize, there are a few rules to follow:
Do not new Number() use new Boolean() , new String() create packaging objects;
Use parseInt() or parseFloat() to convert any type to number ;
The String() method used to convert any type to string , or directly invoke, an obj
1. Uppercase,lowercase Case Conversion{{' lower cap string '|}} //Result: LOWER CAP STRING{{"TANK is good"|}} //Result: Tank is good 2. Date format{{1490161945000| date:"Yyyy-mm-dd HH:mm:ss"}}//2017-03-22 13:52:25 3, number formatting (keep decimals){{149016.1945000| number:2}} 4. Currency Currency format{{]|}} //Result: $250.00{{] | currency:"Rmb¥"}}//Result: rmb¥250.00 5. Filter LookupInput filters can be added to the directive with a pipe character (|) and a filter followed by a
is an object, then the properties inside the object are allowed to be modified.. cannot be duplicate with other identifiers1 Const user = ' GHOSTWU '; 2 console.log (user); 3 user = ' Zhangsan '; Error, cannot be re-assigned value1 const user; Error, no initial value given at the time of definition Constuser={name : ' GHOSTWU ' }; console.log (user.name);//ghostwu user.name= ' Zhangsan '; properties of //objects allowed to be modified console.log (user.name); //zhangsan Const USER = {name: ' G
Uniform motion: Refers to the movement of an object in a straight line, and the displacement of an object through any equal time interval is equal. In fact, it is uniform motion, it is characterized by an acceleration of 0, from the definition, in any equal time interval, the speed and direction are the same.1238 - to + -The above example lets a small ball with a radius of 20px from x=0, y=canvas the height of half, at 2px per frame speed to the right uniform motion.We can encapsulate the ball i
SMS Verification Code countdown can be very good to avoid frequent user access, usually using the JS implementation to obtain SMS Verification code countdown function, the specific implementation of the following:HTML section:Page effect:JS section:Final implementation effectReproduced in this article: http://www.lx598.com/hangyedongtai/1028.htmlJS implementation to send SMS Verification Code Countdown tutorial
); //interception of Slice arrays//var arr4 = Arr3.slice (2);//["C", [+] //var arr4 = Arr3.slice ( -2);//[2,3] //var arr4 = Arr3.slice (4,2);//[] //var arr4 = Arr3.slice (2,4);//["C", 1] The index value includes the coordinates that do not include the right side. //Console.log (ARR3);//Console.log (ARR4);////splice manipulating and intercepting the original array//var arr5 = ["1111", "1111", "1111"];//the//replacement element cannot exist as an array, otherwise the entire array is put int
}} and {else}} is executed; return Options.inverse (this); indicates that the condition is not met, that is, the code between {{else}} and {{/compare}} is executed.Since this is a block-level helper, it is called to add #, for example: {{#compare age 20}}, where ages is the current context to read the old, 20 is the value of casually written side dishes, meaning that as long as age than 20, the display, otherwise full display?Readers can see that the helper can be written in any
Cgi|javascript|js| Tutorial uses JavaScript instead of CGI
You might be familiar with CGI scripts, and you can use CGI to pass numbers or variables from one page to another on a form. Of course, you can use "POST" to pass a variable to a separate thread without appearing in the browser, or to encode the variable to a URL using "get".
JavaScript cannot use the Post method when a variable is processed on th
A tutorial on the example of JS split character Split functionOutput as AAA,BB,CC with alertAnd we can access the array form like PHP.
alert ();
Here's a look at the syntax for split.
Definitions and usageThe split () method is used to split a string into an array of strings.Stringobject.split (SEPARATOR,STR)
Separator required. A string or regular expression that splits the Stringobject from the place
, combined. Net/java, not really, combined with JavaScript to understand is OK.
How the function pass lets the HTTP server work:Look back at our 3rd section. Create an HTTP server:1 var http = require ("http"); 2 3 http.createserver (function(request, Response) {4 response.writehead (200 , {"Content-type": "Text/plain"}); 5 Response.Write ("Hello world!" ); 6 Response.End (); 7 }). Listen (88);Here we use the HTTP object createserver to create the server, we pass in a request w
Leadership to find a conversation, the company is not mixed, said to think clearly after the direction of development what. Just think of node. js.First of all, look at the introduction, the general understanding of node. js, Baidu Search is indeed a lot of chaos, feeling or know the point. Attach the known topic node. JS Address: https://www.zhihu.com/topic/19569535Then I found a novice
parameter, 0 is returned.3. If the string should be placed after the string parameter in the Self-attached table, a positive number is returned. (Majority 1)
[task]var box = 'Lee';alert(box.localeCompare('apple'));//1alert(box.localeCompare('Lee'));//0alert(box.localeCompare('zoo'));//-1
HTML Method
The above is to generate an html Tag through JS. Based on experience, it is of little use.
Var box = 'lil'; alert (box. link ('HTTP: // www.jb51.net'
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.