The preferred Ajax framework for prototype. js lightweight Web Development (2)

Source: Internet
Author: User

Yesterday we shouldTry. These ()This function is also explained, because today we are talking about the encapsulated Ajax class library.

Try. These ()And try {} catch {...} in C {.....}} the same function is to execute a series of functions in order until one of these functions works normally. This seems useless (because javascrpt itself has a try {} catch (E) {} but in fact, it is very natural for you to use this item in some cases. For example, some statements Firefox is not compatible with IE, in this case, you can write two special functions for Firefox and IE respectively, and then use

<SCRIPT>
Function testtry {
ReturnTry. These(
Function () {specifically for IE },
Function () {specifically for Firefox}
); // Lu's blog: http://www.lvjiyong.com
}
</SCRIPT>

In this way, we do not need to check the browser type in advance. When it is IE, executeSpecifically for IEAutomatically jumps out, while Firefox is executingSpecifically for IECannot work normally, so we will continue to executeFor FirefoxThis makes us feel relaxed and can be applied to a wider range of applications.

It's raining. I'm busy first. Let's get here today.

Related Article

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.