Javascript learning notes (onchange, etc)

Source: Internet
Author: User

1. onchange and its onpropertychange, oninput

In IE, you can use onpropertychangel to immediately trigger the listener,
Oninput can be used in FF, but events must be bound using the addEventListener method recommended by w3c.
Http://www.jb51.net/article/25275.htm

2. <button> </button> also has the type attribute:
The input tag is rarely used. Today, the developer uses the button to describe how to use the same tag as the submitted tag in ff. the user can check the manual and find that the type attribute value of the button is submit reset button, in my impression, it is a button, and it is wrong ..
In addition, this label is different by default in IE and ff, and in IE, It is a button and in ff, It is a submit, so click this button under Firefox and submit


3. Attributes of jquery's attr href:
The omnipotent jquery does not eliminate the compatibility issue of finding different href values. In IE, you can use ele. getAttribute ("href", 2) to set the second parameter to 2 to obtain the normal attribute value. For details, refer:

The http://jsfox.cn/blog/javascript/get-right-href-attribute.html;http://msdn.microsoft.com/en-us/library/ms536429 (VS.85). aspx

In addition, IE8 has eliminated this problem. When jQuery load is used to embed a page, the href on this page under IE has been changed, and ele. getAttribute ("href", 2) returns an absolute address.
Refer to http://forum.jquery.com/topic/href-attribute-ie-vs-standards-browsers

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.