<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>easyui</title>
<link rel="stylesheet" type="text/css"
href="/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
<script type="text/javascript" src="/easyui/jquery.min.js"></script>
<script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript">
$(function() {
var userDialog = $("#userDialog");
//點擊添加按鈕,彈出一個窗體Dialog
$("#add").click(function() {
//彈出窗體
userDialog.dialog("open");
});
})
</script>
</head>
<body>
<!-- closed:true隱藏效果 -->
<div id="userDialog" class="easyui-dialog" title="保存用戶"
data-options="iconCls:'icon-save',closed:true"
<!-- auto代表自動判定大小 -->
style="width: 300px; height: auto; padding: 20px" buttons="#btns">
<!--表單必須的屬性:method="post",action提交的url地址,id屬性 -->
<!-- 注意id的命名,建議統一使用XXXForm -->
<form id="userForm" method="post" action="user_save.jsp">
<table>
<tr>
<td>用戶名:</td>
<td><input class="easyui-validatebox" type="text"
<!-- required:true代表此乃必填項 -->
name="username" data-options="required:true"></input></td>
</tr>
<tr>
<td>郵箱地址:</td>
<td><input class="easyui-validatebox" type="text" name="email"
data-options="validType:'email'"></input></td>
</tr>
<tr>
<td>主題:</td>
<td><input class="easyui-validatebox" type="text"
name="subject"
<!-- validType:'length[10,200]'代表限定字符數量為10至200 -->
data-options="required:true,validType:'length[10,200]'"></input></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="message" style="height: 60px;"></textarea></td>
</tr>
</table>
</form>
</div>
<!--按鈕面板作為對話框操作面板 -->
<div id="btns">
<!--不要在href裡面寫js代碼 -->
<a id="btnSubmit" href="javascript:void(0)" class="easyui-linkbutton">保存</a>
<a href="javascript:void(0)" class="easyui-linkbutton"
onclick="$('#userDialog').dialog('close')">取消</a>
</div>
</body>
</html>
就顯示兩個按鈕:
去掉,closed:true這個,要不只能點擊add按鈕打開dialog,頁面也沒有id為add的按鈕,而且不要放html注釋到標簽裡面,放外面去
<div id="userDialog" class="easyui-dialog" title="保存用戶"
data-options="iconCls:'icon-save'"
style="width: 300px; height: auto; padding: 20px" buttons="#btns">
<!--表單必須的屬性:method="post",action提交的url地址,id屬性 -->
<!-- 注意id的命名,建議統一使用XXXForm -->
<form id="userForm" method="post" action="user_save.jsp">
<table>
<tr>
<td>用戶名:</td>
<td><input class="easyui-validatebox" type="text"
name="username" data-options="required:true"></td>
</tr>
<tr>
<td>郵箱地址:</td>
<td><input class="easyui-validatebox" type="text" name="email"
data-options="validType:'email'"></td>
</tr>
<tr>
<td>主題:</td>
<td><input class="easyui-validatebox" type="text"
name="subject"
data-options="required:true,validType:'length[10,200]'"></td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="message" style="height: 60px;"></textarea></td>
</tr>
</table>
</form>
</div>