Ext.onReady(function(){
var myform = new Ext.form.FormPanel({
title : "用户登录表单",
height : 200,
width : 300,
url : "backend.jsp",
method : "POST",
defaults : {
width : 180,
labelWidth : 80,
xtype : "textfield"
},
bodyStyle : "padding : 10px ",
renderTo : Ext.getBody(),
items: [{
fieldLabel : "用户名",
id : "username",
name : "username"
},{
fieldLabel : "密码",
id : "password",
name : "password"
},{
fieldLabel : "爱好",
xtype : "combo",
store : ["男","男的","女","保密"],
id : "hobby",
name : "hobby"
}],
bbar : [{
text : "提交",
handler : function(){
}
},{
text : "取消",
handler : function(){
Ext.MessageBox.alert()
}
}]
})
new Ext.Panel({
title : "用户登录表单",
height : 200,
width : 300,
renderTo : Ext.getBody(),
buttons : [{
text : "提交",
handler : function(){
myform.form.submit({
success : function(form,action){
if(action.result.msg == "OK"){
location.href = 'ext_viewport.jsp';
}else{
alert("error")
}
}
})
//Ext.MessageBox.alert()
}
}],
bbar : [{
text : "提交",
handler : function(){
Ext.MessageBox.alert()
}
}]
})
});
------解决方案--------------------
你自己写的width有问题吧!还有看到你的好几个panel都是renderTo : Ext.getBody(),这个最好还是在页面直接写个div吧!id一样就是了。