jquery-easyui中創建窗口很簡單,建立一個DIV就行了:
<div id="win" class="easyui-window" title="My Window" style="width:300px;height:100px;padding:5px;">
Some Content.
</div>
這樣不用寫一行JS代碼窗口就會出現在屏幕上:
如果想建立一個隱藏的窗口,則需要設置屬性closed="true",需要打開時調用open方法就行:
$('#win').window('open');
作爲例子,我們創建一個登錄窗口:
<div id="win" class="easyui-window" title="Login" style="width:300px;height:180px;">
<form style="padding:10px 20px 10px 40px;">
<p>Name: <input type="text"></p>
<p>Pass: <input type="password"></p>
<div style="padding:5px;text-align:center;">
<a href="#" class="easyui-linkbutton" icon="icon-ok">Ok</a>
<a href="#" class="easyui-linkbutton" icon="icon-cancel">Cancel</a>
</div>
</form>
</div>
效果圖如下:
原文及下載地址:http://jquery-easyui.wikidot.com/tutorial:win1