This article summarizes the common problems with JavaScript function definitions. Contains the mistakes that beginners often make. Share to everyone for your reference. The concrete summary is as follows:
1. function declaration while the JS engine
[1,2,3]. Length can be 3, "123". Length also can get 3, this slightly understand JS all know.
But Eval. Length, RegExp. Length, "". ToString. Length, 1..toString. What does length get?
Get 1, 2, 0, 1 respectively, what do these numbers mean?
In
Using JavaScript screenshots, here I recommend two open source components: One is canvas2image, it can canvas drawing programming png/jpeg/bmp image; But it's not enough, we need to take screenshots of any DOM (or at least most of it). This requires
button
of the context
Add bind at this time
Copy Code code as follows:
var text = document.getElementById ("text");
var button = document.getElementById ("button");
Button.onclick = function () {
alert (this.id);
In this paper, we illustrate the method of JavaScript to implement the delay loading of IFRAME frame. Share to everyone for your reference. The implementation methods are as follows:
Sometimes we want some of the page to achieve delay loading, so
1:scope Scope of Action
Copy Code code as follows:
(function () {
var a = b = 5;
})();
Console.log (b);
What will be printed on the console?
Reply
The code above will print 5.
The trick to this problem is that
An HTML string is a string with an HTML special symbol such as ' aklsdjfklsjdfl ', which we usually have to process and then output to prevent the output from being a true HTML element, which is the
If the string is very long and there are a lot
JavaScript has scope (scope), scope chain (scope chain), execute context (execution contexts), active object (active objects), dynamic scope (animated scope), Closure ( Closure) These concepts, to understand these concepts, we from the static and
In a project, we need to put the information in the XML fields in the database in the page, if we use SQL to read. In this case, the inevitable result is too complex, so I thought, if the XML field first read out, and then use JS to operate, so it
Do you know the limits of deferred and recursion times? Here is a good example, you can see
function Runasynctts (text,speecher,audiopath) {
var def = jquery.deferred ();
var args = {"Synthtext": Text, "Voicespeecher": Speecher,
HTML code:
Copy Code code as follows:
This is the parent element, the screen resolution is 1366*768
This is a child element, I wish you a Happy National day
This is the grandson element, I wish you all Happy National Day
TypeOf is an operator that returns the result of an operand as a string of 6 types (es only, not host environment objects).
1. ' Undefined '2. ' Boolean '3. ' String '4. ' Number '5. ' Object '6. ' Function '
Because it is an operator, it is not a
PS: is to get the style, not to set the style. If no style value is set for the element, the default value given by the browser is returned. (Forum finishing)
1. Element.style: can only get the style values written in the style attribute in the
Compare the adjacent elements. If the first one is bigger than the second one, swap them both.Do the same work for each pair of adjacent elements, from the first pair to the end of the last couple. At this point, the final element should be the
A few days ago, a netizen asked me to use Requirejs and Seajs on the front end, and I asked him if your company had ever written a JavaScript library, or JavaScript framework, and his answer was nothing. He just heard that like Requirejs and Seajs
document.write command to output text to a page
This example uses the JavaScript document.write command to output the specified text to the page with the following code:
Copy Code code as follows:
Save the previous section of
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