碰到个问题。 自己引用的一个日历插件。。在火狐上可以显示出来在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){”这一行报对象不支持此属性和方法,求指点。。

解决方案 »

  1.   

    可能是trim()这个方法没有,你普通调用一下"str".trim()看行不行
      

  2.   

    貌似是这个trim()原因。。但是我之前在别的项目中显示就没有问题啊。。也是用的一模一样的插件。 。都没改什么的。。 
      

  3.   

    <script language="javascript">
       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>