var dump = function(obj){ var a = ""; for(var i in obj){ a += "<div style='line-heigth:20px;border-bottom:1px dashed #DDDDDD;margin-bottom:10px;'>名字:[<span style='color:red'>"+i+"</span>] 类型: [<span style='color:green'>"+typeof(obj[i])+"</span>] 值:<br /><textarea style='width:630px;height:90px;'>"+obj[i] + "</textarea></div><br />"; } var win = new Ext.Window({ title: "Dom查看器", width: 700, height: 450, modal: false, closeAction: "close", resizable: true, maximizable: true, autoScroll: true, items: [ { xtype: "panel", border: false, width: 640, html: "<pre>"+a+"</pre>" } ], buttons: [ { text: CNOA.lang.btnClose, bodyStyle: "padding:10px;", iconCls: 'icon-dialog-cancel', handler: function(){ win.close(); } } ] }).show(); }
使用方法:
dump(object);