JavaScript Basics and JS generalization

Source: Internet
Author: User
Tags object model

JS Content Summary:

Html structured CSS style JavaScript behavior interaction 01. JavaScript base 02.JavaScript operates BOM object 03.JavaScript operation Dom Object *****04. JavaScript Object-oriented--------------------------------------05.jQuery (JS). css. Js06.jquery selector ******07.jquery events and animations 08. jquery Operation Dom object ******09. Form validation 10. Form Validation Framework jquery validate11.bootstrap encapsulates HTML CSS JS
First, java| Script Basics (livescript):
01. It is not related to the Java language, just occasion.
02. is a scripting language ending with. js (scripting language: A computer language created to shorten the traditional authoring-compile-link-run process)
03 Browser compiled JavaScript, parser called JavaScript engine
04 No pre-compilation, JS is a weak language type var a=10;var a= "12";
purpose of study:
01. Customer-side form verification, enhance the user experience and reduce the pressure on the server.
02. Achieve page dynamic effect, improve user experience
03jQuery Foundation
components:
01.ECMAscript Standard: Language Specification
02.BOM Browser Object Model: Provides methods and interfaces for working with Web page content
03.DOM Document Object Model: Provides methods and interfaces for interacting with the browser
introduce the order of CSS and JS:CSS is written in the head, the JS file is written at the bottom of the body (call to call)
js Execution principle:The client sends a request to the browser, a JavaScript page is processed by the browser, and the file is sent to the customer service (reducing bandwidth waste to improve the user experience).
How to introduce JS:
01. In-Line introduction:
<onload= "alert (' Beginner JavaScript ')"
<body>
02. Internal Introduction:
<script type= "Text/javascript" >
Alert ("Beginner JavaScript");
<script/>
03. External Introduction:
<script type= "Text/javascript" src=cs.js>
</script>
</body>
Second, JS in the common events:
01. Do not want a hyperlink immediately jump to the specified page 02. Want to let the user click on the time to do some processing work  javascript:  pseudo Protocol     01. First to execute the JS code     02. Operate alert according to JS code     (' Just do not jump ')   subsequent to the function (method) of an operation    <a href= "Javascript:alert (' Just don't Jump ')" > Jump </a> Pseudo-protocol   Javascript:o Nclick Click event onblur  lose focus event onfocus get focus Event
The data type in JS:
Undefined: Not defined (TRUE) and declared but not given an initial worth variable (var a)
Number: contains integers and floating-point
String: Single and double quotation marks are caused by string
Boolean:true and False
Objects in Object:js, containing arrays, NULL, and objects
Null: null value, indicating that the object does not exist, equals undefined
How data types are detected:
01.typeof Space Variable
02typeof (variable)
Type conversions:
parseint (): Converts a variable to a number, returns the first value that is not a number, otherwise returns Nan
Parsefort (): variable can only be changed to floating point
To force type conversions:
Number: Converts the variable to a numeric value, and returns Nan if one is not a value
Boolean (): As long as the variable is not false,0,undefined,null,nan, undefined argument or undefined          empty string, or nothing entered! All others return to true!
  = = and = = =  = =: When comparing two variables, type conversion is performed before comparison! Alert ("0" ==false), first converts the string "0" to number 0false and converts it 00==0===: more rigorous, compare the types of two variables first, then compare the values! No type Conversions!  Note:  01. If you compare a Boolean value in a variable, the value of the Boolean type is first converted to number type! 02. If you compare the value of a string in a variable, the value of string type will be converted to number type first!  Enter and Confirm  alert (): There is only one OK button!            Confirm (): Is a prompt box with OK and Cancel button!         The user clicks the OK return value is true the user clicks the Cancel return value is Falseprompt (): Is a dialog box! 01. The first parameter is the prompt statement 02. The second parameter is the default value in the input box, and you can omit the return value as our second parameter (user input)! JS also has the choice structure! Consistent with the usage in Java!    Array  var arr1=new array (); No length var arr1=new Array (5);  There is a length of 5var arr1=new Array (1,2,3,4,5)//define the array at the same time Var arr1=[1,2,3]; Add a new element to the array push to concatenate each element in the array into a string using the specified delimiter! Join  Loop for in  for (var index in arrs) {document.write (Arrs[index])}index is the subscript of the element! The  function  defines the function in two ways <a href= "Javascript:sayhello (' small black '); > Jump </a> function SayHello (userName) {alert (username+ "hard!)   "); } var sayhello=function (userName) {alert (username+ "hard!) "); }

JavaScript basics and JS generalization

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.