这是JS代码//wiseman 函数库
window.wiseman={};
(
   function()
   {
      var c= window.wiseman;
      
      c.count = 0;
      .....
      //初始化用户配置信息
       c.initialize = function(url,userName)
      {  
         this.setPageheaderimg();   
         .....
      };
    }
)(); 为什么在调用时.在IE中可以.在火狐中不行.调用如下
     function sinitialize()
    {
       var str = document.all.<%=userurl.ClientID %>.value;
       if(wiseman)
          window.alert('ok');
       wiseman.initialize(str+wiseman.geturldomain(),'<%=UserName %>');
    }在IE中 wiseman 对象为真 而在火狐中就为null 了.怎么办?

解决方案 »

  1.   

    没有问题啊,你检查下自己的代码其他一些不兼容的地方!<script type="text/javascript">window.wiseman = {};(function(){var c = window.wiseman;c.count = 0;c.test = function(x){alert(x);}})();wiseman.test(wiseman.count);</script>
      

  2.   

    不好意思.这个封装没问题.我搞错了.
    大家看看这个呀// JScript 文件 
    var TestService = new Class({     initialize : function(str) 
        { 
            window.alert(str); 
        } 
    }); 
    function init() 

        var test = new TestService("sfs"); 
    } 为什么调用 init() 不好使呀.提示我找不到对象
      

  3.   

    var str = document.all. <%=userurl.ClientID %>.value; 
    在火狐中不支持document.all
    改成var str = document.getElementById(' <%=userurl.ClientID %>').value; 试试