When doing the project encountered a problem, to determine whether an object is empty object, found that this judgment can be, on the code:
1. Code 1:
var a = {};
if (!a) {console.log (1);}
else if (a = = null) {Console.log (2);}
else
Control carriage return Focus issue:
Copy Code code as follows:
The first thing you need to know is how to initialize the event, the basic statement is as follows:
Document.onkeydown = KeyDown
When the browser reads this
This is one of the most intriguing features in JavaScript, like the tenses in high school English, such as the passive tense, past tense, present tense, past time, and, no matter how many times you miss, the next time you may be mistaken. This
Objective
I'm sure you all know that when you declare a variable and do not assign a value, its initial value is undefined. But in JavaScript, how do you check if a value is undefined?
In short, in modern browsers, you can safely compare whether a
First, Dom Basics
1. Nodes (node) hierarchy
document--the topmost node, all the other nodes are attached to it.
DOCUMENTTYPE--DTD references (using syntax), which cannot contain child nodes.
documentfragment--can save other nodes like the
What is the function hijacking of javascript?
function hijacking, as the name suggests, is to hijack a function before it is run, adding the functionality we want. When this function is actually running, it is not the original function, but with
Objective
If you want to ask which of the two knowledge points in JavaScript are confusing, scoping queries and mechanisms are definitely at the this top. So this article starts this with four binding rules in JavaScript, so let's take a look.
Objective:
Select the first conforming DOM object based on the incoming selector type.① can get DOM objects, such as $ ("#adom") by ID;② can get DOM objects, such as $ ("a"), through tagname;③ can get a DOM object, such as $ (". ClassA"), by a
The first is the most conventional approach:
test
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
One day, when we know that JavaScript is separated from the HTML structure, we
Online about the implementation of the shopping cart code is very much, today read some knowledge points, decided to write their own hands, so wrote a simple shopping cart, then explain the specific implementation.
1, using HTML to achieve content;
What is a JavaScript injection attack?
1, JavaScript injection is in the browser address bar to enter a paragraph of JS code, used to change the page JS variables, page label content.With JavaScript injection, users can change their content without
Everyone has almost all the experience of shopping online, some websites will have a product magnifying glass function, is to move the mouse to the picture on the time, next to have another big picture display, equal to magnifying glass effect, that
About JS in this keyword article has been a lot of, I have seen several, I wrote this article is the purpose of the analysis from the example of this work principle, I hope to help.First, the basic:
Copy Code code as follows:
function
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
But this code is below the Firefox 2.x, still can't support the function of Onpaste (), the good news is that the 3.x version of Firefox supports a
There are three types of nodes: element node, attribute node and text node.
The main point of Dom is to check the additions and deletions around element nodes and attribute nodes . The following are described separately from the operation of
Objective
Jshint is used to analyze and verify that JavaScript code conforms to your coding rules. This powerful tool can help you find bugs and problems in your code, and it forces your team to maintain certain coding conventions and styles that
Here's how to get the IndexOf function in JavaScript to ignore the case.
Change them all to uppercase or lowercase, and compare them.
This is a relatively simple approach!
IndexOf the character position of the substring for the first time within the
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