phpcmsV9中表单向导在js调用里日期控件在IE下报Calendar未定义的解决办法

最近在phpcmsV9里用表单向导弄个的提交表单,但用了日期和时间类型时,用
 
<script language='javascript' src='{APP_PATH}index.php?m=formguide&c=index&a=show&formid=11&action=js&siteid=1'></script>
 
调用时在IE下报  “Calendar”未定义  的错误,致使日期控件无法使用
 
原因是由在IE下,calendar.js文件加载没有阻塞Calendar.setup()方法的运行,Calendar.setup()在calendar.js未加载的情况,就开始执行了,所以就报出“Calendar”未定义  的错误
 
解决办法:
找到phpcms/libs/class/form.class.php文件
 
在174到182行
 

Calendar.setup({
weekNumbers: '.$showweek.',
   inputField : "'.$id.'",
   trigger    : "'.$id.'",
   dateFormat: "'.$format.'",
   showTime: '.$showsTime.',
   minuteStep: 1,
   onSelect   : function() {this.hide();}
});

改成:

$(function(){
Calendar.setup({
weekNumbers: '.$showweek.',
   inputField : "'.$id.'",
   trigger    : "'.$id.'",
   dateFormat: "'.$format.'",
   showTime: '.$showsTime.',
   minuteStep: 1,
   onSelect   : function() {this.hide();}
});
});
原文地址:https://www.cnblogs.com/wawahaha/p/3554592.html