Discussion on Window.event | | Ev

Source: Internet
Author: User

Before doing the project encountered this problem, but too lazy no summary, today to summarize

onclick= the phrase "alert (Arguments.callee)" casually put in an element, try different browsers will have pop-up what?

Results:

IE7 and IE8-------> function onclick () {alert (Arguments.callee)} had to say that these two old boys can't keep up with the pace of the times, only by the programmer dragged away. IE6 has been abandoned by Microsoft, I heard Ali is no longer compatible to IE6

IE9, Firefox, chrome------>function onclick (event) {alert (Arguments.callee)}

There might be people who don't know arguments, first of all, to say this object, yes, an object, an array-like object

Many JS libraries take advantage of arguments objects, so agruments objects are necessary for JavaScript programmers to be familiar with.

Alert (arguments instanceof Array);//return False

Alert (typeof (arguments));//Return Object

one of the functions can create a flexible function

When the function parameter is indeterminate, but through arguments can know the specific number of function parameters

Note: Arguments is a copy of the argument, which means it is not related to the parameter!

Arguments.callee returns a reference to the function itself that is being executed, how to understand it, the reference to the function itself, yes, that is, is not very familiar, recursive Ah, recursion is not the reference itself, the callee method can be perfect to achieve recursion!

There's another way to caller, not to mention it here.

Go back to where you started.

Because there are compatibility issues, we often need to write this

function function (EV) {     var event = window.event| | EV;}

Also, when a function does not have an argument, the first value of the Arguemgns object is the event object.

Discussion on Window.event | | Ev

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.