Javascript:
is a descriptive language and a scripting language that is Object-and event-driven and has security capabilities. Features: 1, mainly used in the HTML page to add interactive behavior. 2, is a scripting language, syntax and Java similar. 3, commonly used to write the client script. 4, is an explanatory language, the side of the execution side interpretation. Composition: 1, ECMAScript Standard: Description, specifies the scripting language standard 2, Browser object model: Provides object independent of content and browser interaction 3, Document Object model: Access manipulate HTML document JavaScript: Write HTML output:
document.write ("content");
Warning: alert ("output statement"); • Prompt dialog box: prompt ("prompt statement", default value given)
Note: double quotes in single quotation marks are OK to respond to events: <button type= "button" onclick= "alert (' welcome! ')" > Click here </button> often used to verify the user's input: if IsNaN (x) {alert ("Not Numeric")}; <script> Tags: If you want to insert JavaScript in an HTML page, use the <script> tab. <script> and </script> will tell JavaScript where to start and end.
<script>alert ("My first JavaScript");</script>
You can write a. js script in the same directory as the HTML5 file to write the code to execute and
Use <script type= "Text/javascript" src= "script path. js" ></script> function: typeof (variable or value) : Returns the type of note: If it is a null type or a reference type, the object syntax convention is returned: case-sensitive, must use letters or $ or _, must be preceded by; Common methods for 2.String types: indexOf (Str,index): Finds the position of the first occurrence of a specified character in a string Charat (index): Returns the character at the specified position toLowerCase (): Converted to lowercase touppercase (): Convert to uppercase substring (INDEX1,INDEX2): Intercepts the string at the specified position, split before the package (): Split the string into an array definition var array name = new Array (length);(2) Assign value 1) define and assign var array name = new Array (value 1, value 2); 2) definition of assignment arrays name [subscript] = value 3) not defined by object var array name = [value 1, Value 2]4) Common method Length: Join (): Stitch array element value, return string sort (): Log Group Order push (): Adds one or more elements to the end of the array, and returns a new length function: parseint (): Looks for a value in values and returns Parsefloat (): Finds a floating-point value in a value and returns isNaN (): Determines whether it is a special numeric type: Example: 12s Custom Function: 1, Define function name (parameter) {//Statement [return value]}2, invoke event name = ' function name () '; 3. Common event onload: a page or image finishes loading Onlick: Click Object onmouseover: Move mouse to an element onkey Down: One keyboard pressed onchange: The contents of the domain were changed
Quickly and efficiently create web interaction effects with jquery-Chapter One JavaScript basics