jQuery UI Datepicker IE8使用的基本解决方法
版本 jquery-ui-1.8.6.min. js
解决 IE8无法响应其中jquery.ui.datepicker部分标签a(无href)的onclick事件和td由于放入标签a href="#"无法响应自身onclick事件只验证了icon-trigger模式
方法
509行解决选择日期总小一
月:f. selectedDay=f.currentDay=d("a",e) .html () ;
改
为: if(e==e. toString() ) {f. selectedDay=f.currentDay=e; }else{f. selectedDay=f.currentDay=$('a' ,e) .html () ; } ;
525行解决上一月无效: '<a class="ui-datepicker-prevui-corner-all"onclick="DP_jQuery_'
改为: '<a class="ui-datepicker-prevui-corner-all"href="javascript:DP_jQuery_'
526行解决下一月无效: '<a class="ui-datepicker-next ui-corner-all"onclick="DP_jQuery_'
改为: '<a class="ui-datepicker-next ui-corner-all"href="javascript:DP_jQuery_'
532行去掉td响应click事件:+(J?"": 'onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a. id+"' , "+q.getMonth()+", "+q.getFullYear()+' , this) ;return false;"' )
直接删除
533行给标签a加入href: (B?" ui-priority-secondary":"")+' "href="#">'+q.getDate()+"</a>")
把href="#"改
为:href="javascript:DP_jQuery_'+y+' .datepicker._selectDay(\'#'+a. id+'\' , '+q.getMonth()+' , '+q.getFullYear()+' , '+q.getDate()+' ) ;"
效果图
使用范例如下
<html>
<head>
<link rel="stylesheet" type="text/css"href="styles/jquery-ui-redmond-1.8.6.css" />
<script src="scripts/jquery-1.4.2.min. js"type="text/javascript"></script>
<script src="scripts/jquery-ui-1.8.6.min. js"type="text/javascript"></script>
<style>
.ui-datepicker .ui-datepicker-title select
{font-size: 1em;margin: 1px 0;
}
.ui-datepickerselect.ui-datepicker-month-year
{width: 100%;
}
.ui-datepickerselect.ui-datepicker-month, .ui-datepickerselect.ui-datepicker-year
{width: 40%;
}
.ui-datepicker .ui-datepicker-title select.ui-datepicker-year
{float: left;
}
.ui-datepicker-div, .ui-datepicker-inline, #ui-datepicker-div
{font-size: 0.7em;
}
</style>
<script>
$(function () {
$.datepicker.regional[' zh-CN' ] = {closeText: '关闭' ,prevText: '<上月' ,nextText: '下月> ' ,currentText: '今天' ,monthNames: ['01月' , '02月' , '03月' , '04月' , '05月' , '06月' , '07月' , '08月' , '09月' , ' 10月' , ' 11月' , ' 12月' ] ,monthNamesShort: ['01月' , '02月' , '03月' , '04月' , '05月' , '06月' , '07月' , '08月' , '09月' , ' 10月' , ' 11月' , ' 12月' ] ,dayNames: ['星期日' , '星期一' , '星期二' , '星期三' , '星期四' , '星期五' , '星期六' ] ,dayNamesShort: ['周日' , '周一' , '周二' , '周三' , '周四' , '周五' , '周六' ] ,da六
dateFormat: 'yy-mm-dd' , f irstDay: 1,isRTL: false
} ;
$.datepicker. setDefaults($.datepicker.regional[' zh-CN' ]) ;
$("#datepicker") .datepicker( {showOn: "button",buttonImage: "images/calendar.gif",buttonImageOnly: true
} ) ;
//$('#datepicker' ) .datepicker('option' , { dateFormat:"y y-mm-d d" } ) ;
} ) ;
</script>
</head>
<body>
<input type="text" id="datepicker">
</body>
</html>
GigsGigsCloud是一家成立于2015年老牌国外主机商,提供VPS主机和独立服务器租用,数据中心包括美国洛杉矶、中国香港、新加坡、马来西亚和日本等。商家VPS主机基于KVM架构,绝大部分系列产品中国访问速度不错,比如洛杉矶机房有CN2 GIA、AS9929及高防线路等。目前Los Angeles - SimpleCloud with Premium China DDOS Protectio...
提速啦简单介绍下提速啦 是成立于2012年的IDC老兵 长期以来是很多入门级IDC用户的必选商家 便宜 稳定 廉价 是你创业分销的不二之选,目前市场上很多的商家都是从提速啦拿货然后去分销的。提速啦最新物理机活动 爆炸便宜的香港CN2物理服务器 和 日本CN2物理服务器香港CTG E5 2650 16G内存 20M CN2带宽 1T硬盘 150元/月日本CN2 E5 2650 16G内存 20M C...
官方网站:https://www.akkocloud.com/AkkoCloud新品英国伦敦CN2 GIA已上线三网回程CN2 GIA 国内速度优秀.电信去程CN2 GIALooking Glass:http://lonlg.akkocloud.com/Speedtest:http://lonlg.akkocloud.com/speedtest/新品上线刚好碰上国庆节 特此放上国庆专属九折循环优惠...