关闭

用jquery实现添加新用户

565人阅读 评论(0) 收藏 举报
<!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>

<script language="javascript" type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script language="javascript" type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.8.18.custom.css" />





<link rel="stylesheet" href="./themes/base/jquery.ui.all.css">
	<script src="./js/jquery-1.7.1.js"></script>
	<script src="./js/jquery.bgiframe-2.1.2.js"></script>
	<script src="./ui/jquery.ui.core.js"></script>
	<script src="./ui/jquery.ui.widget.js"></script>
	<script src="./ui/jquery.ui.mouse.js"></script>
	<script src="./ui/jquery.ui.button.js"></script>
	<script src="./ui/jquery.ui.draggable.js"></script>
	<script src="./ui/jquery.ui.position.js"></script>
	<script src="./ui/jquery.ui.resizable.js"></script>
	<script src="./ui/jquery.ui.dialog.js"></script>
	<script src="./ui/jquery.effects.core.js"></script>
	<link rel="stylesheet" href="./css/demos.css">
<style>
		body { font-size: 62.5%; }
		input { display:block; }
		input.text { margin-bottom:12px; width:95%; padding: .4em; }
		fieldset { padding:0; border:0; margin-top:25px; }
		h2 { font-size: 1.2em; margin: .6em 0; }
		div#user { width: 350px; margin: 20px 0; }
		div#user table { margin: 1em 0; border-collapse: collapse; width: 100%; }
		div#user table td, div#user table th { border: 1px solid #eee; padding: .6em 10px; text-align: center; }
		
		
	</style>




<script language="javascript" type="text/javascript">
$(function(){
	
	
	var name=$("#name"),email=$("#email"),pass=$("#password");
	
	
	
	$("#add").dialog({
		
		autoOpen:false,
		
		title:"添加新用户",
		
		show:"explode",
		
		hide:"explode",
		
		modal:true,
		
		buttons:[{
			
			text:"确定添加",
			
			click:function(){
				
				$("#user table").append("<tr><td>"+name.val()+"</td><td>"+email.val()+"</td><td>"+pass.val()+"</td></tr>");
				$(this).dialog("close");
			      }
				},
			{
			 text:"取消",
			 
			 click:function(){	
				
				$(this).dialog("close");
				
				}
			
			}]
		
		
		});
		
	 
	
	
	$("#add_link").click(function(){
		
		$("#add").dialog("open");
		
		
		})
	
	})

</script>
</head>

<body>
<div class="demo">
<h2>现有用户</h2>
<div id="user" class="ui-widget">
<table class="ui-widget ui-widget-content">

 <tr class="ui-widget-header ">
 
   <th>姓名</th><th>邮箱</th><th>密码</th>
   
 </tr>
 
</table>
</div>
<br />
<br />
<button id="add_link">添加用户</button>
</div>
<div id="add">
<fieldset>
姓名:<input type="text" value="" id="name" class="text ui-widget-content ui-corner-all" />
<br />
邮箱:<input type="text" value="" id="email" class="text ui-widget-content ui-corner-all" />
<br />
密码:<input type="password" value="" id="password" class="text ui-widget-content ui-corner-all" />
</fieldset>
</div>

</body>
</html>


0
1

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:37159次
    • 积分:760
    • 等级:
    • 排名:千里之外
    • 原创:33篇
    • 转载:21篇
    • 译文:6篇
    • 评论:17条