In js, we need to check whether the variable is a number. We can directly use the isNaN function. The isNaN function judges the opposite. If you input a number, it returns false, not the data, you can clear this point.
IsNaN Function
IsNaN
In javascript, if we want to obtain the object content, js provides three methods for us: outerhtml, innerhtml, and innertext. But what is the difference between them and their specific usage, maybe many people do not know.
Sample Code:
The core principle of redirection is that the user adds a change to the select statement. When the user clicks, The js obtains the value of the selected select statement and jumps, for more information, see.
My most commonly used code, the core code
Common cross-origin requests in js include four types: window. name, JSONP, jQuery. the first method is to use iframe, the second and third methods use json data, and the last one is xml file operations. Here is a brief introduction.
1. window. name
We generally use window to refresh the framework in js. parent command, which is used to refresh the parent window in a child window. to refresh the parent window, specify the window. parent [Window name] to operate. Next I will give you an instance.
This article introduces the tips for improving the readability of JavaScript code. Here we will introduce the methods. For more information, see.
Flattening Logic
In our work, we may encounter some complicated logic, such as: Meet condition 1, or XX;
In the webpage, the button does not have the attribute of tag a. If we want to add a jump event to the button, we can click the jump js on The onclick event, below I will introduce some common methods.
How can I jump to another page by clicking the
Some time, we do not want the editor to have online management functions. For example, our message board certainly does not want other users to directly have online image management functions. How can we delete these functions, the following article
For many times, we do not know how to judge whether a variable is an array or an object. Next I will give you a detailed introduction to js to determine whether a variable is an object or an array instance.
All typeof objects are returned.
In
This article describes how to solve the problem that JavaScript cannot read the src file of the script tag. Script tag
Generally, when we create a script tag on the page, src either introduces an external js file:?
1
script
This is the TAB (js + css) switching technology that I often use in website design. One is click switching, and the other is touch switching, which is comprehensive. Although there will be a lot of online searches, the tabs below are carefully
In js, it is easy to directly use window to achieve page Jump. location. href can be implemented. If you want to perform a scheduled jump, you need to use the setTimeout Function to set a scheduled jump. I will summarize it for you.
The following is
We often need to look for some characters in the string or some content in html. Next I will introduce how to use the js indexOf method, according to the syntax of the indexOf method, stringObject. indexOf (the string to be searched, the position
The principle of private instance variables is based on the scope. Private instance variables are implemented using the var keyword in JavaScript Functions and only valid within functions.
If you have been familiar with other languages, you should
This article introduces how to solve js new date () function not supported in IE browser. For more information, see.
Solution 1
The Code is as follows:
Copy code
Function NewDate (str ){If (str = null)Return false;Str = str.
PNG images are transparent in other browsers and can have a perfect example of transparent background effect without any processing. However, ie6 cannot recognize the png Image transparency function in ie6, next I will introduce several methods for
There are many methods to search for characters in js. One is to search for a specific string and return a string, and the other is to find the position of the string. I will share with you their implementation methods.
Searches for a specific
In js, RegExp objects have three methods: test (), exec (), and compile (). They can all be used to find strings, the following is a summary of their usage.
Example 1: exec ()
1,
The Code is as follows:
Copy code
Ajax is often used, but most of the ajax compatibility found on the Internet is not strong. I have changed a good and compatible ajax function, and the jquery ajax compatibility introduced later is also very strong.
Example
The Code is as
To determine whether a user is a mobile browser is actually very simple. We only need to obtain the userAgent information of the browser, and then we can determine and match the userAgent to determine whether the user is a mobile browser.
Recently,
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