用js创造easyui layout为什么创建不了,用html却可以不明白
用js创建easyui layout为什么创建不了,用html却可以不明白
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<link type="text/css" rel="stylesheet" href="easyui-1.3.2/themes/default/easyui.css" />
<link type="text/css" rel="stylesheet" href="easyui-1.3.2/themes/icon.css" />
<link type="text/css" rel="stylesheet" href="css/icon.css">
<link type="text/css" rel="stylesheet" href="css/index-easyui.css">
<script type="text/javascript" src="easyui-1.3.2/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="easyui-1.3.2/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui-1.3.2/locale/easyui-lang-zh_CN.js"></script>
<title>Insert title here</title>
<script type="text/javascript">
$(function(){
$("#mainLayout").layout('add',{
region:'north',
title:'北',
heigth:60
});
$("#mainLayout").layout('add',{
region:'south',
title:'南',
heigth:100
});
$("#mainLayout").layout('add',{
region:'east',
title:'西',
width:100
});
$("#mainLayout").layout('add',{
region:'west',
title:'东',
width:100
});
$("#mainLayout").layout('add',{
region:'west',
title:'中'
});
})
</script>
</head>
<body >
<div id="mainLayout"></div>
</body>
</html>
------解决思路----------------------
layout要有center区域,代码里的“中”还是west
------解决思路----------------------
ID为mainLayout的DIV需要指定高和宽,另外要先$("#mainLayout").layout();然后再添加区域

------解决思路----------------------
另外楼主的height写成了heigth了,上面的代码也跟着错了
<%@ page language="java" contentType="text/html; charset=GB18030"
pageEncoding="GB18030"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<link type="text/css" rel="stylesheet" href="easyui-1.3.2/themes/default/easyui.css" />
<link type="text/css" rel="stylesheet" href="easyui-1.3.2/themes/icon.css" />
<link type="text/css" rel="stylesheet" href="css/icon.css">
<link type="text/css" rel="stylesheet" href="css/index-easyui.css">
<script type="text/javascript" src="easyui-1.3.2/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="easyui-1.3.2/jquery.easyui.min.js"></script>
<script type="text/javascript" src="easyui-1.3.2/locale/easyui-lang-zh_CN.js"></script>
<title>Insert title here</title>
<script type="text/javascript">
$(function(){
$("#mainLayout").layout('add',{
region:'north',
title:'北',
heigth:60
});
$("#mainLayout").layout('add',{
region:'south',
title:'南',
heigth:100
});
$("#mainLayout").layout('add',{
region:'east',
title:'西',
width:100
});
$("#mainLayout").layout('add',{
region:'west',
title:'东',
width:100
});
$("#mainLayout").layout('add',{
region:'west',
title:'中'
});
})
</script>
</head>
<body >
<div id="mainLayout"></div>
</body>
</html>
------解决思路----------------------
layout要有center区域,代码里的“中”还是west
------解决思路----------------------
ID为mainLayout的DIV需要指定高和宽,另外要先$("#mainLayout").layout();然后再添加区域
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="../Scripts/jquery-easyui-1.4/themes/black/easyui.css" rel="stylesheet" />
<script src="../Scripts/jquery-easyui-1.4/jquery.min.js"></script>
<script src="../Scripts/jquery-easyui-1.4/jquery.easyui.min.js"></script>
<title>Insert title here</title>
<script type="text/javascript">
$(function () {
$("#mainLayout").layout();
$("#mainLayout").layout('add', {
region: 'north',
title: '北',
heigth: 60
});
$("#mainLayout").layout('add', {
region: 'south',
title: '南',
heigth: 100
});
$("#mainLayout").layout('add', {
region: 'east',
title: '西',
width: 100
});
$("#mainLayout").layout('add', {
region: 'west',
title: '东',
width: 100
});
$("#mainLayout").layout('add', {
region: 'center',
title: '中'
});
})
</script>
</head>
<body>
<div id="mainLayout" style="width:500px; height:500px;"></div>
</body>
</html>
------解决思路----------------------
另外楼主的height写成了heigth了,上面的代码也跟着错了