|
使用方法:
1.加入YUI.Ext 庫到你的web程序:
<!-- YAHOO UI Utilities Lib, you will need to replace this with the path to your YUI lib file -->
<script type="text/Javascript" src="deepcms/yui/utilities_2.1.0.js"></script><script type="text/Javascript" src="deepcms/yui-ext.0.33-rc1/yui-ext.js"></script>
2.加入樣式表 CSS Style 。如果你是一個美工,最多打交道的地方,可能就是這幾個文件:
<!--YahooUI! Ext -->
<link rel="stylesheet" type="text/css" href="yui-ext.0.33-rc1/resources/css/reset-min.css" />
<link rel="stylesheet" type="text/css" href="yui-ext.0.33-rc1/resources/css/resizable.css" />
<link rel="stylesheet" type="text/css" href="yui-ext.0.33-rc1/resources/css/tabs.css" />
<link rel="stylesheet" type="text/css" href="yui-ext.0.33-rc1/resources/css/basic-dialog.css" />
3.加入一個holder.holder的意思是一個載體,JS處理好數(shù)據(jù),轉(zhuǎn)變成內(nèi)容(Contents,文字、圖片、表格等)放在這里,也可以理解為一個架子,承托所有內(nèi)容。holder表現(xiàn)形式很簡單,通常是幾行div。
<div id="hello-dlg" style="visibility:hidden;position:absolute;top:0px;">
<div class="ydlg-hd">中易旅游網(wǎng)</div>
<div class="ydlg-bd"> 您沒確認(rèn)條款內(nèi)容。</div>
</div>
4.加入定義Dialog腳本,實例化Dialog:
// create the HelloWorld application (single instance)
var HelloWorld = function(){
// everything in this space is private and only accessible in the HelloWorld block
//任何在這個區(qū)域的都是私有變量 ,只能在HelloWorld訪問
var dialog, showBtn;
var toggleTheme = function(){
getEl(document.body, true).toggleClass('ytheme-gray');
};
// return a public interface
return {
init : function(){
showBtn = getEl('goNextBtn'); //綁定一個按鈕
// attach to click event 加入事件
/showBtn.on('click', this.showDialog, this, true);
///getEl('theme-btn').on('click', toggleTheme);
},
showDialog : function(){
if(!dialog){ //因為采用單例模式,不能被new重復(fù)實例。這里是用懶惰的方法作判斷。
dialog = new YAHOO.ext.BasicDialog("hello-dlg", {
modal:true,//這段代碼是dialog的一些參數(shù),如大小、有 主站蜘蛛池模板: 武义县| 招远市| 喀喇沁旗| 泸州市| 乌拉特前旗| 高邑县| 安达市| 霸州市| 民和| 九龙县| 余庆县| 远安县| 宜兰市| 平果县| 沈阳市| 黎川县| 叶城县| 通城县| 九寨沟县| 隆尧县| 宜春市| 婺源县| 唐河县| 庆云县| 长宁区| 德化县| 永定县| 五常市| 沙湾县| 双柏县| 沭阳县| 昌江| 合肥市| 霍州市| 肥城市| 高阳县| 胶南市| 济宁市| 池州市| 德安县| 建德市|