1月 212011
 

有这么一段代码:

 
  1. <input type="text" id="name" />
  2. <input type="text" id="password" />
  3. <script>
  4.     var $ = function (id) { return document.getElementById(id);};
  5.     $("name").focus();
  6.     $("name").blur();
  7.     $("name").onfocus = function () {alert(‘haha’);}
  8. </script>

如果运行在FF下面,像我们期望的那样,在页面载入后,不会立即alert的,但是,在IE7中,页面载入后立即就是一个alert。 显然onfocus事件的绑定被提前做了,不知道为什么。
可恶的IE7!!!

 Posted by at 上午 8:23

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(required)

(required)

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据