用jquery实现添加新用户

<!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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值