There are a lot of scenarios for event listening in js. It is nothing more than determining whether the browser supports addEventListener and attachEvent. There are many methods to search for event listening on the Internet, but there are still some
Currently, many webmasters prefer to use iframe to directly call others' websites. On the surface, it is impossible to see that the website calls others, and all the open views access our servers, however, the viewer thinks this is the other party's
We know that in IE browsers, we can monitor the loading status of elements through onreadystatechange, and then determine whether the elements are loaded through the readyState attribute. In standard browsers such as Chrome and FireFox, we can
In the past, we briefly talked about how to obtain url parameters in js. This article describes how to obtain, set, modify, and parse js url parameters.
Obtain url parameters
The Code is as follows:
Copy code
The core
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 uses several ultra-simple codes to implement title scrolling. For more information, see the reference.
The Code is as follows:
The Code is as follows:
Copy code
(Function (){Var titleScroll = function (){Var
There are many sorting methods for Javascript arrays. js itself provides a large number of data sorting functions. In addition to using it to sort data, other custom sorting methods are also introduced.
Sort by single array
Sort () function
The sort
Window. onerror can be thought of as a lot of useful things in js. Next I will introduce how to use window. onerror. If you need to know it, please do not go to the reference.
The onerror syntax uses three input parameters by default:
• Msg: error
This article describes how to use the key type in javascript for in. for more information, see.
Many while, for (var k = 0; k
The Code is as follows:
Copy code
Function getAvgSum (arr, param, flag ){Var as = 0;If (param
Event binding refers to the process of constructing an HTML element in response to a system or user action. There are no less than five event binding technologies in different browser versions. Below we will quickly introduce these technologies
The
This article describes how to use the onload and complete operations of an image.
Previously, we had to scale the merchant pictures on the merchant page according to the size of the box outside the image. The previous idea was to first output the
This article introduces the src Method for matching images and all image addresses in js regular expressions. For more information, see.
Implementation: Use the js regular expression to match all images and all image addresses in src.
Idea: 1. Match
This article will introduce you in detail a jquery code compatible with the ie6 instance on the top of the suspended page after scrolling to the navigation bar. For more information, see.
Jquery Implementation Method
The Code is as follows:
The most common method to review historical data is to directly use cookies. Of course, session or data is stored directly in the database, in this way, you can view your browsing history at any address. Next I will introduce the method in
A good picture switching effect that can be used to discuss automatic playback with cache effect. You may want to know more about it.
The Code is as follows:
Copy code
automatic playback-slide Buffer Effect
Js to get the page height and width, we can use document. body. offsetHeight (including the height of the edge) and document. body. offsetWidth (including the edge width) is enough. The specific example is as follows.
View the difference using the
We can see that many websites can control the Textarea input box to increase according to the user input content. Below I will summarize the two text boxes based on the input content adaptive height examples.
Use jquery's autoTextarea Method
JS Code,
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
Ajax get usually produces some cached data by default, if we want to disable the creation of cache, we can add a disable cache or add a random parameter after the url to solve the problem of ie cache and ajax cache.
Yesterday we encountered a
Onbeforeunload and onunload events are the functions of the two functions before and when the page is loaded, which can prevent prompt refresh when the page is refreshed or when the page is closed, next I will introduce the usage of onbeforeunload
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