Heim  >  Artikel  >  Web-Frontend  >  javascript 学习笔记(onchange等)_javascript技巧

javascript 学习笔记(onchange等)_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:16:351370Durchsuche
1.onchange 及其onpropertychange,oninput

在IE下可使用onpropertychangel立即触发监听,
oninput 可以使用在FF下,但必须使用w3c推荐的addEventListener的方式来绑定事件.
http://www.jb51.net/article/25275.htm

2. 也有type属性:
很少用一般使用input标签,今天开发那边使用button说在ff下怎么和提交相同,查手册发现button有type属性值为:submit reset button,在我印象中他就是button的,错误了。。
并且此标签在IE和ff下默认不同,IE下为button,ff下为submit,所以在火狐下点击此按钮及提交了


3.jquery的attr href属性:
万能的jquery没有消除求出href值的不同的兼容性问题。在IE下可以使用ele.getAttribute("href",2)使其第二个参数为2来得到正常属性值,参考:

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

并且发现IE8已经消除此问题。在使用jQuery的load来嵌入一个页面的时候IE下此页面里的href已经更改,此时及时使用 ele.getAttribute("href",2)得到的人仍然是绝对地址。
参考http://forum.jquery.com/topic/href-attribute-ie-vs-standards-browsers二楼
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn