means you use it when you want it, don't use it when you don't want it.1. No parameter functionGrammar:function functionname () {This is the code to execute}Create:function myFunction () {alert ("Hello world!" );}2, with parametric functionGrammar:function myFunction (VAR1,VAR2) {This is the code to execute}Create:function myFunction (name,job) {alert ("Welcome" + name + ", the" + Job);}PS: When called, the parameters correspond in order.3. function with return valueSyntax: Plus return statemen
HTML formThe label of the form is The form itself has some properties, such as the action specifies a URL that is processed by the program specified by the URL when the data in the form is submitted. This specified program can be a. php script file, or it can be a path handler in the Flask framework, for example. Other properties include:ACTION specifies a program to handle theMETHOD specifies how to submit this form, optional post,get, etc.Target specifies the destination of the URL in the acti
1.JS is case sensitive. Use the Unicode character set. Ignore extra spaces2. The document.write () method writes the contents to an HTML document. Note: If document.write is executed after the document has finished loading, the entire HTML page will be overwritten.3. Console.log () is primarily handy for your modal JavaScript, and you can see what you are outputting in the page.His advantages compared to alert are:He can see the structure of things, if it is alert, fade out an object is [Object
order based on the values of the associative array
Krsort ()-Sorts the arrays in descending order based on the keys of the associative array
Sort () $cars =array ("Volvo", "BMW", "Toyota"), sort ($cars), $clength =count ($cars); for ($x =0; $x Super Global variablesSeveral super global variables (superglobals) are predefined in PHP, which means they are available in all scopes of a script.
$GLOBALS
$_server
$_request
$_p
FormContains the area of the form element, the form element is the element that allows the user to enter information in the table consignments (text box, drop-down list, radio box, check box, etc.), using the Text fields and Password fieldsform>Username:inputtype= "text"name= "FirstName">BR/>Password:inputtype= "Password"name= "LastName">form>Passwords are replaced with dots.drop-down listform>Selectname= "Cars">optionvalue= "Volvo">Volvooption>option
bits.The maximum number of decimal digits is 17, but the floating-point operation is not always 100% accurate:Octal and hexadecimalIf the prefix is 0, JavaScript interprets numeric constants as octal numbers, and if the prefixes are 0 and "X", they are interpreted as hexadecimal numbers.Tip: Never write 0 in front of the number unless you need to make an octal conversion.Three, String object1) indexOf () methodUse IndexOf () to position the first occurrence of a specified character in a string.
("World")String substitution: Str.replace (/microsoft/, "W3school")3. js date () return format:Thu Feb 17:55:22 gmt+0800 (CST)GetTime ()GetTime () returns the number of milliseconds since January 1, 1970.setFullYear ()How to use setFullYear () to set a specific date.toUTCString ()How to use toUTCString () to convert the date of the day (based on UTC) to a string.GetDay () returns day of the week, number 0-7, starting from Sunday4. JS Arrayvar mycars=new Array("Saab","
the current seconds
Get Time or date
GetTime
Gets the current time (in milliseconds)
Get Time or date
getTimezoneOffset
Get the current time zone offset information
Get Time or date
GetYear
Get the current year
Practice NOTES:1. The first method can create any number of values, just like creating any number of variables:Such as:var mytechnic=new Array ()mytechnic[0]= "HTML"mytechnic[1]= "CSS"mytechnic[2]= "JS"
function. (The scope of the variable is local).As soon as the function is complete, the local variable is deleted.Global JavaScript variablesVariables declared outside of a function are global variables, and all scripts and functions on a Web page can access it.The lifetime of a JavaScript variableThe lifetime of JavaScript variables begins at the time they are declared.Local variables are deleted after the function is run. Global variables are deleted after the page is closed.Assigning a value
, the emergence of object-oriented thinking and become the mainstream of the current way. Both are used throughout the software analysis, design, and development phases, and corresponding object-oriented approaches are referred to as Object-oriented analysis (OOA), Object-oriented design (OOD), and object-oriented programming (OOP).Object-oriented has three main characteristics: encapsulation, inheritance and polymorphism, while process-oriented encapsulation is just encapsulation function, and
JavaScript Data typesFirst, the basic data type:String, number, Boolean, date, and timeJavaScript has a dynamic typeJavaScript has a dynamic type. This means that the same variables can be used for different types:1 var x // x is undefined2var x = 6; // x is a number 3 var x = "Bill"; // x is a stringJavaScript stringA string is a variable that stores characters (such as "Rose").The string can be any text in quotation marks. You can use single or double quotation m
1.JavaScript StringJavaScript strings are used to store and manipulate text.A string can store a series of characters, such as "John Doe."The string can be any character inserted into the quotation marks. You can use single or double quotation marks:var " Volvo XC60 ";You can use the index location to access each character in a string:var character = carname[7];The index of a string starts at 0, which means that the first character index value is [0],
piece of code will take, especially if you are debugging a slow loop.You can even set multiple timers by assigning a label to the method. Let's see how it works:Console.time (' Timer1 '); var items = []; for (var i = 0; i Iv. Console.trace Method--Get stack trace information for a functionThe order in which the functions are executed--to make it easier for you to understand your own code, like a specific menu for your own customizationvar car; var func1 = function () { func2 ()} var func2
object's properties). [also a member of the For Loop family]
The following example uses the for: In iterating over an array object, note the difference between foreach in. NET.
var x
New Array ();
"Saab";
"Volvo";
"BMW";
In Mycars)
{
"
}
JavaScript Events
Events are behaviors that can be detected by JavaScript.
JavaScript gives us the ability to create dynamic pages. Events are behaviors that can be detected by Java
, there are three types of arrays:
Index array-an array with a numeric index
Associative array-An array with the specified key
Multidimensional array-An array that contains one or more arrays
Indexed arrays:
$cars =array ("Volvo", "BMW", "SAAB");
Associative arrays:
$age =array ("Peter" => "," "Ben" => "Panax Notoginseng", "Joe" => "43");
Or
$age [' Peter ']= '];
$age [' Ben ']= ' for "Panax Notogi
Warcraft, Tap Tap Revenge (Jin Orchestra), etc.). LUA uses the MIT protocol-which means that Lua is largely free of commercial and non-commercial goals.
The main data-building mechanism of LUA is the combination of table-variable arrays and hash tables. Listing 1 lists a LUA Table, assuming we describe the car and its mileage per gallon. We can use string-type keys to store vehicle information, such as license and make. The digital subscript index is used to store a series of miles per gallon.
implementation of 1.JSThe JS script must be located between the tags the script tag can be placed in the head or body tag of the HTML file. Generally I like to put it in the head. A. Put it in the head, for example
The function MyFunction () {document.getElementById ("demo"). Innerhtml= "My I-JavaScript Function";}
Here to introduce the external JS file:
Note: Whether externally or directly embedded in HTML, each script tag is publicly accessible to each other in the code, so multiple script ta
Local JavaScript variable
A variable declared inside a JavaScript function (using VAR) is a local variable, so it can only be accessed within the function. (The scope of the variable is local).You can use local variables with the same name in different functions, because only the function that declares the variable can recognize the variable.The local variable is deleted as soon as the function completes.
Global JavaScript variables
Variables declared outside a function are global variables a
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.