Posted on 2007-09-06 17:52
G_G 閱讀(530)
評論(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>