Posted on 2007-09-06 17:52
G_G 阅读(526)
评论(0) 编辑 收藏 所属分类:
javascript Framework
页面 的 LayOut 用: LayoutContainer
这里有个问题 html -> html 的乱码问题不是很好解决(可能是dojo 0.9 bug??) 这 top , left .... 等可以用 .jsp来做 再用dojoLayout加入主页面 .html
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"
>
<
html
>
<
head
>
<
title
>
Layout Container Demo 1
</
title
>
<
style
type
="text/css"
>
@import "http://127.0.0.1:7000/dojoCharset/js/dojo/dijit/themes/tundra/tundra.css";
@import "http://127.0.0.1:7000/dojoCharset/js/dojo/dojo/dojo.css"
</
style
>
<
script
type
="text/javascript"
src
="http://127.0.0.1:7000/dojoCharset/js/dojo/dojo/dojo.js"
djConfig
="parseOnLoad: true"
></
script
>
<
script
type
="text/javascript"
>
dojo.require(
"
dijit.layout.ContentPane
"
);
dojo.require(
"
dijit.layout.LayoutContainer
"
);
</
script
>
</
head
>
<
body
class
="tundra"
>
<
div
dojoType
="dijit.layout.LayoutContainer"
style
="width: 100%; height: 100%"
>
//这里 href 是关键到入 top.jsp 还没乱码问题
<
div
dojoType
="dijit.layout.ContentPane"
layoutAlign
="top"
style
="background-color:red"
href
="http://127.0.0.1:7000/dojoCharset/html/top.jsp"
>
</
div
>
<
div
dojoType
="dijit.layout.ContentPane"
layoutAlign
="left"
style
="background-color:lightblue;width: 120px;"
>
</
div
>
<
div
dojoType
="dijit.layout.ContentPane"
layoutAlign
="client"
style
="background-color:yellow"
>
</
div
>
</
div
>
</
body
></
html
>
或者用 一种比较复杂但灵活的方法
<html>
<head>
<title>Dojo: Hello World!</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- SECTION 1 -->
<script type="text/javascript"
src="http://127.0.0.1:7000/dojoCharset/js/dojo/dojo/dojo.js"></script>
<!-- SECTION 2 -->
<script type="text/javascript">
function helloPressed()
{
dojo.xhrGet({
url: 'http://127.0.0.1:7000/dojoCharset/dojo',
handleAs: "text",
encoding: "utf-8",
timeout: 5000, // Time in milliseconds
load: function(data, ioArgs) {
window.alert(data); // Prints "peach"
document.getElementById('div').innerHTML = data ;
// div 添加
}
});
}
dojo.addOnLoad(helloPressed);
</script>
<div id='div' />
</html>