Below is the DOM structure of the page
CopyCode The Code is as follows:
one
two
three
four
Below is the JavaScript codeCopy codeThe Code is as follows: // obtain an object by IDFunction ID (v) {return document. getelementbyid (V );}
//
CopyCodeThe Code is as follows: function reportfilestatus (filespec)
{
VaR FSO, S = filespec;
FSO = new activexobject ("scripting. FileSystemObject ");
If (FSO. fileexists (filespec ))
S + = "exists .";
Else
S + = "doesn' t exist .";
Return (
The OOP language enables us to customize object and variable types.
Object-Oriented ProgrammingJavascript is object-orientedProgramming Language(OOP ). The OOP language enables us to define our own objects and variable types. The object has
1. Calculate the length of the string
CopyCode The Code is as follows: var TXT = "Hello world! "
Document. Write (txt. length)
2. indexof () methodHow to Use indexof () to locate the first occurrence of a specified character in a string.Copy
Therefore, we need to use currentStyle of IE and getPropertyValue of W3C to obtain it.
Elem. style. the method for retrieving styles by attr is not mentioned. first, let's look at the currentStyle method. This object exclusive to ie represents the
Str. replace (/\-/g ,"! "), You can replace all matched characters (g is the global flag ).
Replace ()
The replace () method returns the string that results when you replace text matching its first argument
(A regular expression) with the text of
Official explanationA closure is an environment expression (usually a function) that has many variables and is bound to these variables. Therefore, these variables are part of the Environment expression.
General ExplanationAll functions in
Http://perfectionkills.com/javascript-quiz/
Below are some of my own understandings about these questions. If you have any different opinions or opinions, please feel free to give a picture.
Copy codeThe Code is as follows: (function (){
Return
Compared with other languages, the javascript scripting language is too clever and lively. I personally like writing javascript code. Although the famous javascript libraries on the Internet are flooded with the network, jQuery, Prototype, Base,
I. Data TypesJavascript is a weak scripting language. It has six data types and is divided into basic data types, special data types, and composite data types.
1. Basic data types: numeric, string, and Boolean
2. Special Data Types: null and
Copy codeThe Code is as follows:
Appendix:
Value Type and reference type in JavaScript
Data Type value/reference type Remarks
The undefined value has no value.
Number Value
Boolean Value
String Value strings are processed by reference type
The following is the sample code for various methods:
Copy codeThe Code is as follows:
The running result is:Call the general method:--------------------------------------------------------------------------------Call the constructor method:
Including stu. hta (HTML application );Stu. xmlNote that the following HTML code must be saved with the suffix hta. Otherwise, when you perform operations on the XML file (add, delete, modify, and delete), the system will prompt that you do not have
1. prototype:
(1). Using prototype can greatly reduce the memory demand for each object, because the object can inherit many attributes.
(2). Objects can inherit these attributes even if they are added to the prototype after the object is
The first method is more common. The accessor is implemented through the closure Store Value, which is suitable for all browsers.
Copy codeThe Code is as follows: function Sandy (val ){
Var value = val;
This. getValue = function (){
Return value;
};
1
Copy codeThe Code is as follows: // html content is written to the page.
Document. write (" Hello World! ")
2Copy codeThe Code is as follows: // to prevent JavaScript from being displayed as page content in browsers that do not support JavaScript/
Functions:
1. Sorting function: Click the row header or list header to sort in the forward direction. If you click it again, the reverse order is performed;
2. Modify function: Double-click a cell to perform the input operation. When the input box
Space Processing
When "a [any space] a" is entered in the DIV, HTML is displayed in the same way as Chrome and IE: Only one space is displayed.
InnerHTML attributes
IE still adds a space to two a's,
Chrome is the original input.
Enter
In ECMAScript, all declared variables seen outside the function at the function declaration can be accessed inside the function.Final value!
Closure functions can only access the final value of a variable !!!
Eg:
Function fnTest (arr ){For (var I
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