怎样在Extjs框架中嵌入html

怎样在Extjs框架中嵌入html,第1张

用html属性

{bodyStyle:'background:#069color:#FFFfont-size:12pxpadding-top:12px',html:'欢迎您!管理员'}

完整案例:

var hd={//这个就是上

region:'north',

height:40,

bodyStyle:'background:#069color:#FFFfont-size:12pxpadding-top:12px',

html:'欢迎您!管理员'

}

var mainMenu={

id:'menu_panel',

region:'west',

title:'功能菜单',

iconCls:'icon_menu',

split:true,

width:135,

minSize:100,

maxSize:250,

margins:'2 0 5 5',

cmargins:'2 5 5 5',

collapsible:true,

bodyBorder:false,

bodyStyle:'background-color:#DFE8F6',

layout:{type:'accordion',animate:false},

defaults:{border:false,bodyStyle:'padding:0px'},

items:[]

}

var modulePanel={

id:'module_panel',

region:'center',

border:false,

layout:'card',

margins:'2 5 5 0',

cmargins:'2 5 5 5',

activeItem:0,

items:[

{title:'欢迎进入管理系统 V1.0',id:'dashboard',

html:'内容区'

}]

}

var viewport=new Ext.Viewport({

layout:'border',

items:[hd,mainMenu,modulePanel]

})

viewport.doLayout()

window.onload必须等到页面内包括图片的所有元素加载完毕后才能执行。

$(document).ready()是DOM结构绘制完毕后就执行,不必等到加载完毕。

所以,你把function 放进 $(document).ready() 这里试一下

var form1 = new Ext.form.FormPanel({

renderTo:'form1',

height:100,

width:200,

title:'刷新HTML',

layout:'form',

frame:true,

html:'<div id="123">11111111111</div>',

items:[],

buttons:[{

text:'刷新',

handler:function(){

Ext.Ajax.request({

url:'test.aspx?cmd=getinfo',

success:function(response){

var data = Ext.decode(response.responseText)

var ss = document.getElementById('123')

ss.innerHTML = data.info

},

failure:function(){

Ext.Msg.alert('错误','与后台联系的时候出现了错误')

}

})

}

}]

})

<body>

<div id="form1"></div>

</body>

//后台C#

if (cmd == "getinfo")

{

string info = string.Empty

//--数据库获取值自己写--//

//获取之后赋值给info

info = "123321"

res = "{info:'" + info + "'}"

Response.Write(res)

Response.End()

}


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/bake/11557190.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-17
下一篇2023-05-17

发表评论

登录后才能评论

评论列表(0条)

    保存