Ext布局实例-----cardLayout布局

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>cardLayout.html</title>

<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">

<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>

<script type="text/javascript">
Ext.onReady(function(){

var panel=new Ext.Panel({
layout:'card',
activeItem:0,
title:'Ext.layout.CardLayout示例',
frame:true,
height:250,
width:300,
applyTo:'panel',
items:[
{
title:'嵌套面板一',
html:'说明一',
id:'p1'
},
{
title:'嵌套面板二',
html:'说明2',
id:'p2'
},
{
title:'嵌套面板三',
html:'说明三',
id:'p3'
},
{
title:'嵌套面板四',
html:'说明四',
id:'p4'
}
],
buttons:[
{
text:'上一页',
handler:changePage

},
{
text:'下一页',
handler:changePage
}

]
});

function changePage(btn){
var index=Number(panel.layout.activeItem.id.substring(1));
if(btn.text=='上一页'){
index-=1;
if(index<1){
index=1;
}
}else{
index+=1;
if(index>3){

index=3;
}
}

panel.layout.setActiveItem('p'+index);

}




});
</script>

</head>

<body>
<div id="panel"></div>
</body>
</html>

你可能感兴趣的:(layout)