Defining a String Object
A JavaScript string object is used to work with text strings. The syntax for creating a String object is as follows:
Copy Code code as follows:
of the above three methods, only the first one is to
JavaScript Sub Method
The Sub method returns the subscript string defined using the HTML Sub Label property. The syntax is as follows:
Copy Code code as follows:
Str_object.sub ()
Tip: This method does not conform to the
Basic concepts
javascript是一门解释型的语言,浏览器充当解释器。
Delay script
The defer attribute is defined in HTML4.0.1, and its purpose is to indicate that the script does not affect the construction of the page when it executes. That is, the script is deferred
Event object: (an Event object is a property of a Window object that, when an event occurs, produces an event object, the event ends, and an event object disappears)
In IE: window.event;//get objects
DOM: argument[0];//fetching objects
The
Some time ago need to get the source of the page through JavaScript, this operation is very simple, using document.referrer can be obtained. However, there are still a lot of surprises in the application, and here is a simple arrangement.
The first
First, some concepts: 1. The mouse event has a Botton property: Returns an integer that indicates which mouse button was clicked.BUG: In IE and standard DOM mouse events, the only button property value is the same as the "Right-click" event, which
First, some concepts
① Traditional ajax: Interactive data format--custom string or XML description;
Cross-domain-Resolved by server-side proxy.
② today's best scenario: Use JSON format to transfer data, use JSONP to cross domains.
③json: A data
Yesterday in writing the last dynamic generation of the box and text box to limit the input encountered a problem, the text box entered the time to start to calculate the text box input How many words, naturally thought of the onkeydown event, and
We know that the operators that detect object types in JavaScript are: typeof, Instanceof, and the constructor properties of objects:
1) The typeof operator TypeOf is a unary operator, and the return result is a string indicating the type of the
Introduced
Lower-level languages, such as C, have low-level memory management commands, such as malloc () and free (), which require developers to manually release memory. However, a high-level language like JavaScript is different, objects
Dodo previously in the group on the Online web page test screenshots of the site, then forgot to collect, the results in the chat records find a long time to find, first recorded here:
http://v03.browsershots.org/
Have time to write their own
3 ways to get function namesExample 1:
A way to see in the JS authoritative guide:
Function.prototype.getName = function () {return THIS.name | | This.tostring (). Match (/function\s* ([^ (]*) \ (/) [1]}
Example 2:
If the current function is a
Using JavaScript to determine the Office version is useful in project development, by being an online Office editor in OA system, where we need to have Office Online editing tools that support multiple versions of Office, such as Office2003, 2007.
This example describes the JavaScript Cross-domain request wrapper function and usage. Share to everyone for your reference, specific as follows:
First, the source code
Defines the JSON (function () {if (typeof window. $JSON = = ' undefined ')
A method of defining regular expressions
There are two ways to define a regular expression: the constructor definition and the regular expression direct quantity definition. For example:
Copy Code code as follows:
var reg1 = new
This article for everyone to share the JS to create the object of a variety of methods to share the pros and cons of a method, the specific contents are as follows
The first way to create an object:
Creating a JSON ObjectRecommended occasions: As
JavaScript function is a strange thing, in contact with a period of time you will be confused, do not understand what it is. Do you get confused by the fact that there are no names for JavaScript functions, and whether the JavaScript function is
Some languages, such as C and Java, have block-level scopes, where each piece of code within the curly braces has its own scope, and variables are not visible outside of the code snippet in which they are declared, but JavaScript does not have a
Copy Code code as follows:
The above example creates a handler object, and the Handler.handlerfun () method is assigned to the Click event handler of the DOM button. The design intent is this: when the button is clicked to trigger
JS decoding and Coding-html
Copy Code code as follows:
javascript encoding and decoding
Crazy han san xiong up!
Use of SetInterval and settimeout in JS. html
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