先发段代码片段:在firefox中可以运行,360跟IE下就不可以
var  dhxLayout = null, tree = null ,toolbar=null ,attachGrid1=null,isTooLoad=false,dhxWins= new dhtmlXWindows();
dhxLayout = new dhtmlXLayoutObject(document.body, "2u");
    dhxLayout.cells("a").setWidth(200);   
    dhxLayout.cells("a").setText("交换机列表");
    dhxLayout.cells("a").fixSize(true,true);
    tree = dhxLayout.cells("a").attachTree();
           //(5)
    toolbar = dhxLayout.cells("b").attachToolbar();
dhxLayout.cells("b").setText("");
toolbar.setIconsPath("${request.getContextPath()}/resources/toolbarXml/icons/");
toolbar.loadXML("${request.getContextPath() }/resources/toolbarXml/switches_toolbar.xml?rt=" + new Date().valueOf());
toolbar.attachEvent("onClick",function(id){
toolbar_Action(id);
      }); attachGrid1 = dhxLayout.cells("b").attachGrid();
        attachGrid1.setImagePath("${request.getContextPath()}/js/dhtmlxGrid/skins/");
        attachGrid1.setHeader("名称,内容,名称2,内容2");
        attachGrid1.setNoHeader(true);
        attachGrid1.enableEditEvents(false,false,false);
        attachGrid1.setInitWidths("100,*");  
        attachGrid1.init(); tree.setImagePath("${request.getContextPath()}/js/dhtmlxTree/imgs/");//1
setProgress(tree, "a");//2
tree.loadXML("${request.getContextPath()}/switches/switches_listTree?"+ new Date().valueOf());//3
然后把123几行挪到5处,在360IE会显示。然后有个问题来了 要写个方法
tree.attachEvent("onClick",function(id){
if(tree.getSelectedItemText()=="你登录已经超时!"&&id=="no_login"){
artDialog.tips("你登录已经超时,重新登录后再操作");

}else{
attachGrid1.clearAndLoad("${request.getContextPath()}/switches/show_switches/"+id);
}

    });这个方法放在那里都不行在360跟ie中。

解决方案 »

  1.   

    attachEvent不支持 Mozilla系列(ie、360)
    如果是Mozilla系列,需要用到addEventListener
      

  2.   


    不是这样吧,Mozilla firefox 浏览器。。attachEvent方法在360 ie可以用,我想问的是  顺序不同在360 ie 就不显示。。该怎么解决
      

  3.   

    attachEvent这个方法类库应该重写过了,没用过这个类库,自己找找有么有成功生成控件后的回调事件什么的,在这个事件中执行tree.attachEvent("onClick"的绑定
      

  4.   

    解决了。又回去翻了下文档。。 attachGrid1.setHeader("名称,内容,名称2,内容2");
    这个出错了。。哎。firefox下可以,360就直接不行了