In js, call and apply are used to bind functions to another object for running. The two functions are different only when defining parameters, next I will introduce the call and apply usage.
In the web Front-end development process, we often need to
Now that smartphones are popular, we are engaged in touch screen events. In the past, JavaScript writing could not meet some requirements. Next I will introduce you to several js Mobile Phone Touch Screen events.
Processing Touch events allows you
To obtain the browser information string in js, you only need to use navigator. userAgent. In this way, you can use indexof to determine the version or other information. The following describes several instances.
The use of Javascript userAgent
The title may not be clearly written, indicating that the user is prompted to save the data before the user leaves the page or closes the browser, and whether to leave the page. Here we will use a window. onbeforeunload event.
Example
The
I want to share with you an article about how to skillfully use the inert loading of functions to improve the javascript code performance. I hope this tutorial will be helpful to you.
In JavaScript code, because of the behavior differences between
In applications, external js usually affects the website's opening speed and experience. In some JavaScript files, we can delay loading, next I will introduce the external js loading instance test of webpage delayed loading. I hope to help you.
In
In js, onfocus and onblur are acquired and lost, while in jquery, focus and blur are both used. The two are slightly different. Let's take a look at them.
In js, onfocus, onblur, onmouseover, and so on will be used. jquery binds events. The
The method to achieve random sorting of arrays is actually very simple, but Baidu found that there are a large number of such instances, but I strongly recommend these three instances. The random sorting written by a foreign user is not repeated, it'
The setTimeout function is a scheduled function that can call a specified function every few seconds for operations. Below is an infinite loop instance, one is that the setTimeout function can pass the parameter/value passing instance, both of which
Use location. reload () or location. href to refresh the current page in js. Of course, we can use window. parent. frames to refresh the framework page. Let's take a look.
Reload MethodThis method forces the browser to refresh the current
In the past, we used js to determine whether the user was submitting by pressing ctrl + enter. Next I will introduce two page Jump methods by pressing the keyboard combination key.
Use a keyboard to redirect pages. Change the address after location
In js, array sorting uses array. sort (). The following is an example of sort () array sorting, hoping to help you.
By default, the sort () method arranges array items in ascending order-that is, the smallest value is located at the beginning, and
Here are some tips for optimizing the data format of JSONP. I hope it will be helpful to you.
When using JSON to transmit data, the field names are too repeated during list transfer, which wastes bandwidth and reduces efficiency. For example:
Because of the special nature of the Checkbox, we usually define a function to select all or invert the Checkbox instance. the Checkbox Processing Method in jquery and js will be different. Let's take a look at it.
Use JS to select all checkpoints
This article introduces some problems and solutions when using variables in Javascript Regular Expressions. It mainly describes the replacement and RegExp methods.
Example 1: replace with a variable
The replace function can be replaced by a regular
A more practical testing of the javascript pop-up layer pop-up scan, I hope it will be helpful to all of you.
Js click a button to bring up a layer and cover the content behind the page to make it translucent. This effect is widely used, for example,
Iframe is unfriendly to search engines. We may not find iframe content in Baidu, but iframe is commonly used. Let's take a look at some examples in js and iframe applications.
Iframe is used by many websites. Although it is convenient for
The following shows how to copy the content to the clipboard in three JavaScript codes, which is compatible with various browser methods. One is JavaScript and the other is jquery. The other is the clipboardswf method.
Method 1: Copy all js files to
This article introduces you to a javascript multi-line news rolling effect code. The compatibility is not good, and the calling method is also very simple. Let's take a look at the example.
The Code is as follows:
Copy code
This article introduces an example code of jquery ajax submitting form items. I hope this tutorial will be helpful to you.
The Code is as follows:
Copy code
$ ("Form [name = 'createbox']"). submit (function (){Var self = this;
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.