Limitations of testing
In this chapter we intend to find out which events can be used to simulate mouse events. Note that this series of tests does not include screen readers. Because I can't meet all the conditions, the test has its limitations.
However, in today's large web interaction projects, such as large webgame projects, the JavaScript event bubbling effect is worth paying attention to. This article is a simple example of JavaScript event bubbling and usage considerations.
If you're
Look at the code.
Untitled Page
document.getElementById ("Adiv"). Innerhtml=txt.join ("");
Using innerHTML will escape to HTML. Bold Show out
Using innertext does not translate, the labels are all out.
JS in the OK this function, just like C #
1. Use hidden iframe to load ad pages.
Copy Code code as follows:
Using the above code will cause the IFRAME to load the ad page, if the page is too large, the speed will be very slow,
can use Ajax to implement
In retrospect, IE will kill some of the blanks in front of the label, and it will be all uppercase tags, will display the dynamically added properties, in some elements, it is still read-only. This was invented by IE, the last thing to be blown so
Look at the code, do not speak:
Copy Code code as follows:
var i=arr.length;
while (i--)
{
Write something?
}
It's Google.
Array.jsIn the program
Recommended ImprovementsThe code. Think about why i--to the I for 0
1. In practical work, all kinds of assignment statements will be written.
For example, the most commonly used Obj.style.display = "none";
If one of these assignment statements is too many, the Obj.style will look dizzy in a row.
The Extend
Unfortunately, the browsers are different.
i) Event names are not the same
IE, Khtml (Safari, Chrome), opera's corresponding event name is "MouseWheel". and Gecko (Firefox, Netscape) The corresponding event name is "Dommousescroll".
second, the
Even someone asked me "There are 5 text boxes on the page, each text box can only enter one character, how to use JS to implement the user input the first text box after the focus of automatic jump to the second." ”。
I said this function is not
The following is a multiple-choice question: The official address is http://perfectionkills.com/javascript-quiz/
Copy Code code as follows:
1.
(function () {
return typeof arguments;
})();
"Object"
"Array"
"Arguments"
"Undefined"
JavaScript native string processing functions are not very rich,
Native String function: http://www.jb51.net/w3school/js/jsref_obj_string.htm
Question 1: Is there an extension library that is only for type string?
There is, not much, not
1. The difference between event streams
IE uses a bubbling event Netscape uses the capture event DOM to use the first-captured bubble-type event
Example:
Copy Code code as follows:
Click here
Bubble Type
1,prototype Program Library
This is the first library to simplify the document.getElementById () to $.
For example: the original Var myele=document.getelementbyid (' id ') is equivalent to the Var myele=$ (' id ')
In addition, $ also extends
As the title, this article will use pure script JavaScript to implement the gradient of the pop-up layer, the idea is very simple: the use of IFRAME to mask, and then use a div to show the content of the pop-up layer, and finally then using its
Nesting functions are allowed in javascript:
nested functions
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
Remember this remark:
Nesting is actually to implement a
Copy Code code as follows:
Modified code:
Copy Code code as follows:
Note:
To use the 1:preventdefault function, refer to https://developer.mozilla.org/en/dom/event.preventdefault
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