When querySelector () or querySelectorAll () is used to find an element similar to name = "2nd_btn", FF, chrome, and IE8 will report an error.FF, chrome reports the same error, as shown below:Error: uncaught exception: [Exception... "An invalid or
Javascript does not have the namespace concept, but it must reflect the object-oriented idea,There should be namespaces, just like the package in java and the namespace in. net,To prevent class name conflicts, the same class names do not conflict as
The implementation code is as follows. At first, the test was normal (and then encountered a problem). First, let's look at the initial code.Copy codeThe Code is as follows:Var docs = document. body. innerHTML;Var links = docs. match (/ed2k. * \ | \
The last two sections talk about the JavaScript object-oriented namespace and the javascript object-oriented JavaScript class. You can read the above before proceeding.In fact, it is very simple. I believe you will be clear at a glance after reading
Scalable encapsulation to facilitate different effects. The source code provides the fade function and the move function.One-sentence function call to achieve image switching special effects.PicChange ("id of the image ul list", switching the image
Click Add to dynamically add two text boxes: x and y, respectively. Click Cancel to delete the two text boxes of the row.Remember to introduce jquery. jsCopy codeThe Code is as follows: Html codeCopy codeThe Code is as follows:Project name & Lt;
JQuery is used in An aspx page, but when the Internet Explorer 6 opens this page, it will report "Internet Explorer cannot open the Internet site http: // localhost: 9001/Index. aspx. operation aborted "error, and then the page cannot be browsed
JS Add/delete events in IE and dom browsers are: attachEvent (add event in ie), detachEvent (delete event in ie), and addEventListener (add event in dom browser ), removeEventListener (supports deletion events in the dom browser ).For example, when
Singleton) A unit is created when a script is loaded. It organizes a series of associated variables and methods into a logical unit. The content in the logical unit is accessed through a single variable;A monomer is mainly divided into three parts.
1. Open a link in a new window The target = "_ blank" attribute is not supported in XHTML 1.0 Strict. JQuery can solve this problem well and enable the webpage to be opened in a new window:Copy codeThe Code is as follows:$ ('A [@ rel $ = 'external']
Implementation Principle
Change all images that require delayed loading to the following format:
Then, when loading the page, save all images that use lazy_src to the array, and calculate the top of the visible area during
The foreign bank page is caused by this error, resulting in the loss of a large number of users and the failure to use the bank's online banking and other causes heavy losses.Therefore, if you want to avoid errors in terms of user experience and
JavaScript Information EncapsulationBefore coding, we need to understand the following terms;Encapsulation: hides the internal data representation and implementation details;Private attributes and Methods: external users can only access and interact
Written as follows:This method is called when the onXXXevent () event of the acitveX control is triggered.If you have a half, dozens of such functions fill up my pages. Besides, in VS2008, "setting selected content formatting" always prompts "failed
So after studying gzip for a while, I found that it is easier to implement it only with LZ77. The haffman compression section in gzip is too difficult for JS.The Code is as follows. The comments are very complete, so I will not talk about them much.
The call is simple, as long as the data is organized into json format: the format is as follows:Copy codeThe Code is as follows:Window. onload = function (){Var tf = "if1 ";Var data = [{m: "sports site", s: [{sn: "Baidu Sports", st:
1. Talk about custom events todayWe all know about events, but many frameworks have implementation of custom events. I wrote a simple one and shared it with you,Copy codeThe Code is as follows: 2. innerHTML is used by all users. It is very helpful,
(1) how to use JQuery to refresh an image?Note: We all know that when we request a resource (such as a webpage or image), if the resource is cached in the browser, the request returns a cached copy, it is not the resource we want to obtain (the
Js Singleton writing JS Singleton mode are you? (Singleton) are you? (Normal) [Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]Loop. js is a js class in singleton mode:// You can create a
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.