选择后,jquery ui datepicker在IE7中不会消失

让jQuery UI datepicker插件运行得非常好,但是,当使用IE7时,日历不会像你在FF,Safari等中那样做出选择后逐渐消失。

这是URL http://www.mchenry.edu/insideApp/OIRPprojectrequest/oirpprojectrequestform.aspx

我希望这有点傻,’因为IE7是我需要支持内部客户的唯一浏览器。

日Thnx!

编辑:试试这个url, http : //www.mchenry.edu/test/oirpprojectrequestform.aspx

对不起’那个!

网页错误详情

用户代理:Mozilla / 4.0(兼容; MSIE 8.0; Windows NT 5.1; Trident / 4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)时间戳:2009年9月21日星期一18: 50:51 UTC

消息:’length’为null或不是对象行:139 Char:17代码:0 URI: http : //www.mchenry.edu/aspnet_client/system_web/1_1_4322/WebUIValidation.js

当我单步执行IE8时, event.srcElement.Validators undefined 。 您是要访问DispHTMLAnchorElement上的DispHTMLAnchorElement吗?

如果你在datepicker设置中有这样的东西:

onSelect:function(){this.focus(); } onClose:function(){this.focus(); }

这会导致元素被赋予焦点,从而由validation器插件validation。

不幸的是,在IE7中,这会导致错误,因为焦点事件被调用两次并且日期选择器变得混乱并再次弹出。

解决方案不是在元素上显式调用validation器,然后将焦点移动到IE的下一个元素以保留Tab键顺序。

  onSelect: function () { var elementCounter, input, form; input = $(this); form = input.parents('form:first'); // validate the selected date form.validate().element(this); if ($.browser.msie && $.browser.version < 8) { // MSIE 7 triggers focus event twice, forcing the datepicker to re-open // to get around this, we move the focus to the next form element for (var elementCounter = 0; elementCounter < form[0].elements.length; elementCounter++){ if (form[0].elements[elementCounter].name == input.attr('name')) { $(form[0].elements[elementCounter+1]).focus(); break; } } } else { // give focus back to the input element to preserve tabbing $(this).trigger('focus'); } }, onClose: function () { // validate the selected date $(this).parents('form:first').validate().element(this); } 

如果在输入字段中指定tabindex属性,那么这可能适合您:

 onClose: function() { $('input[tabindex="' + ($(this).attr('tabindex') + 1) + '"]').focus(); }