EasyUI建立對話方塊的兩種方式,easyui建立兩種方式
對話方塊(Dialog)是一個特殊的視窗(window),可以包含在頂部的工具列和在底部的按鈕。預設情況下,對話方塊(Dialog)不能改變大小,但是使用者可以設定 resizable 屬性為 true,使其可以改變大小。
這種就是對話方塊了。
EasyUI有兩種建立方式:
第一種:通過已存在的DOM節點元素標籤建立
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><!-- 匯入js檔案 --><!-- 匯入jquery核心js檔案 --><script type="text/javascript" src="jquery.min.js"></script><!-- 匯入easyui核心js檔案 --><script type="text/javascript" src="jquery.easyui.min.js"></script><!-- 匯入本地語言的js檔案--><script type="text/javascript" src="locale/easyui-lang-zh_CN.js"></script><!-- 匯入css --><!-- 匯入easyui的預設css檔案--><link type="text/css" rel="stylesheet" href="themes/default/easyui.css"/><!-- 匯入表徵圖的css檔案 --><link type="text/css" rel="stylesheet" href="themes/icon.css"/></head><body><div id="dd" class="easyui-dialog" title="我的對話方塊" style="width:400px;height:200px;" data-options="iconCls:'icon-save',resizable:true,modal:true"> 提示內容</div> </body></html>
第二種:通過js動態建立對話方塊
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><!-- 匯入js檔案 --><!-- 匯入jquery核心js檔案 --><script type="text/javascript" src="jquery.min.js"></script><!-- 匯入easyui核心js檔案 --><script type="text/javascript" src="jquery.easyui.min.js"></script><!-- 匯入本地語言的js檔案--><script type="text/javascript" src="locale/easyui-lang-zh_CN.js"></script><!-- 匯入css --><!-- 匯入easyui的預設css檔案--><link type="text/css" rel="stylesheet" href="themes/default/easyui.css"/><!-- 匯入表徵圖的css檔案 --><link type="text/css" rel="stylesheet" href="themes/icon.css"/></head><body><!--<div id="dd" class="easyui-dialog" title="我的對話方塊" style="width:400px;height:200px;" data-options="iconCls:'icon-save',resizable:true,modal:true"> 提示內容</div> --> <div id="dd">對話方塊內容</div><script type="text/javascript">$("#dd").dialog({title: '我的對話方塊', //標題collapsible:true, //是否可摺疊minimizable:true, //最小化按鈕maximizable:true,//最大化按鈕resizable:true,//是否改變視窗大小width: 400, height: 200, closed: false, cache: false, href: 'beautiful.html', });</script></body></html>
以上所述是小編給大家介紹的EasyUI建立對話方塊的兩種方式,希望對大家有所協助,如果大家有任何疑問請給我留言,小編會及時回複大家的。在此也非常感謝大家對幫客之家網站的支援!