碰到个问题。 自己引用的一个日历插件。。在火狐上可以显示出来在IE上却提示“对象不支持此属性或方法”,求大神们指点~下面附上部分代码:<input name="rptDate" type="text" pattern="string" label="日期"
size="50" autocheck="true" maxlength="10" onclick="SelectDate3(this);"
required="true">上面的点击以后调用的是一个WebCalendar.js里面的方法。WebCalendar.js代码附上:var cal;
var isFocus = false; // 是否为焦点
function SelectDate3(obj){
SelectDate2(obj, 'yyyy-MM-dd');
}
function SelectDate2(obj, strFormat){
SelectDate(obj,strFormat,10);
}
function SelectDate(obj, strFormat, ages){
var date = new Date();
var by = date.getFullYear() - ages; // 最小值 → 50 年前
var ey = date.getFullYear() + ages; // 最大值 → 50 年后
// cal = new Calendar(by, ey,1,strFormat); //初始化英文版,0 为中文版
cal = (cal == null) ? new Calendar(by, ey, 2) : cal; // 不用每次都初始化
// 2006-12-03 修正
cal.dateFormatStyle = strFormat;
if(cal.getValue(obj).trim().length > 0){
cal.setMaxAndMixYear(cal.getValue(obj),cal.beginYear,cal.endYear);
}
cal.show(obj);
cal.bindData();
}提示的是“if(cal.getValue(obj).trim().length > 0){”这一行报对象不支持此属性和方法,求指点。。
size="50" autocheck="true" maxlength="10" onclick="SelectDate3(this);"
required="true">上面的点击以后调用的是一个WebCalendar.js里面的方法。WebCalendar.js代码附上:var cal;
var isFocus = false; // 是否为焦点
function SelectDate3(obj){
SelectDate2(obj, 'yyyy-MM-dd');
}
function SelectDate2(obj, strFormat){
SelectDate(obj,strFormat,10);
}
function SelectDate(obj, strFormat, ages){
var date = new Date();
var by = date.getFullYear() - ages; // 最小值 → 50 年前
var ey = date.getFullYear() + ages; // 最大值 → 50 年后
// cal = new Calendar(by, ey,1,strFormat); //初始化英文版,0 为中文版
cal = (cal == null) ? new Calendar(by, ey, 2) : cal; // 不用每次都初始化
// 2006-12-03 修正
cal.dateFormatStyle = strFormat;
if(cal.getValue(obj).trim().length > 0){
cal.setMaxAndMixYear(cal.getValue(obj),cal.beginYear,cal.endYear);
}
cal.show(obj);
cal.bindData();
}提示的是“if(cal.getValue(obj).trim().length > 0){”这一行报对象不支持此属性和方法,求指点。。
String.prototype.trim=function(){
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.ltrim=function(){
return this.replace(/(^\s*)/g,"");
}
String.prototype.rtrim=function(){
return this.replace(/(\s*$)/g,"");
}
</script>