People are often confused by this guy when using JavaScript. For most developers with OOP development experience This is an identifier that refers to a common element in the current scope, but it is quirky in JavaScript because it is not fixed, but
What is JavaScript?
JavaScript is a scripting language that is widely used in the development of client Web pages (browsers), such as adding dynamic functions to HTML pages, such as responding to users ' various actions. JavaScript is a scripting
Yesterday modified the EPG page above the set-top box, encountered a small problem. Users need to buy the game pop-up Purchase confirmation dialog box, the default focus of the dialog box must stay on the "Cancel" button. Very simple requirements,
Sample Example:
Less nonsense, directly on the code:
Arrow.js
/** * To achieve the function of two-point arrow @author mapleque@163.com * @version 1.0 * @date 2013.05.23/;(function (window,document) {if (
window.mapleque==undefined) window.
Original topic:
Given a sequence of unordered integers, find the longest sequence of consecutive digits.
For example:
Given [100, 4, 200, 1, 3, 2],
The longest sequential number sequence is [1, 2, 3, 4].
The solution to the side dishes:
Find a lot of trees on the internet to achieve, the total feeling is not satisfactory, not the need to reference JS external files using Plug-ins, is the code too much to see the dizzy, in fact, I just want to implement a simple code, logic is not
First of all, the difference between null and undefined:
Performs typeof on declared but uninitialized and undeclared variables, and returns "undefined".
Null represents an empty object pointer, and the typeof operation returns "Object".
It is
This article summarizes the various operations common to JavaScript, including string, time, form, regular validation, and so on. Has a very high reference value. Share for everyone to use for reference. The specific method is as follows:
/****
Problem description
There are some empty string "" when splitting a string using the JavaScript split method, especially when using regular expressions as delimiters.
Related issues
A JavaScript regular expression produces an empty string group
I always encounter situations where it is necessary to check whether a function is native--a very important part of the functional test: The function is supported by the browser, or is modeled by a Third-party class library. The easiest way to
Peter Seibel, author of Practical Common Lisp, once said that if you need a pattern, there must be something wrong. The problem he said is that because of the innate defects of language, it is necessary to seek and summarize a common solution.
Observer mode (also known as publisher-Subscriber mode) should be one of the most common patterns. are used in a lot of languages. Including the DOM events we normally touch. It is also an observer pattern implemented between JS and Dom.
The most basic function of JavaScript in a Web page is to listen to or respond to a user's actions, which is very useful. The user's action some very high frequency, some very rare. Some listener functions execute like lightning, and some heavy drag
SetTimeout is often used to delay execution of a function:
Copy Code code as follows:
settimeout (function () {
...
}, timeout);
Sometimes the settimeout (function...,0) is used for asynchronous processing, for example:
The performance of JavaScript in the browser can be said to be the most important usability problem faced by the front-end developers.
One of the Yslow23 rules for Yahoo is to put JS on the bottom. The reason is that, in fact, most browsers use a
Copy Code code as follows:
Copy Code code as follows:
Url:
PHP detects URL address validity
The code is as follows
Copy Code code as follows:
?
function Is_url ($STR) {
Return Preg_match
Use JavaScript to take float type two digits after the decimal point, example 22.127456 to 22.13, how to do?
1. This method is least recommended:
function Get () {
var s = 22.127456 + "";
var str = s.substring (0,s.indexof (".") + 3);
alert
Closures are functions that have access to variables in the scope of another function, but the scope configuration mechanism has a need to note that closures can only take the last value that contains any variable in the function.
such as the
Detects whether the current window is closed before the current window closes
In IE9, if the document is refreshed, Unloadform and onbeforeunload will execute, and if the page is closed, only the onbeforeunload event will be executed
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