jQuery实现弹窗动态添加用户信息【详细注解】
2012-03-28 21:07
756 查看
<!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="../../include/jquery.js"></script>
<script language="javascript" type="text/javascript" src="../../include/jquery-ui-1.8.18.custom.min.js"></script>
<link rel="stylesheet" href="../../include/css/ui-lightness/jquery-ui-1.8.18.custom.css" />
<script>
$(function (){
//注册对话框
$("#dialog").dialog({
//设置对话框打开的方式 不是自动打开
autoOpen:false,
show:"blind",
hide:"explode",
modal:true,
buttons:[
{
text:"添加",
click:function (){
//获取姓名
var name=$("input[id=name]").val();
//获取专业
var zhuanye=$("input[id=phone]").val();
//手机
var phone=$("input[id=zhiwei]").val();
var $tr=$("<tr style='background-color:#FFF'><td align='center' width='200'>"+name+"</td><td align='center' width='200'>"+zhuanye+"</td><td align='center' width='200'>"+phone+
"</td></tr>");
$tr.appendTo("#table2");
$(this).dialog("close");
}
},{
text:"取消",
click:function(){
$(this).dialog("close");
}
}
],
closeOnEscape:false, //是否esc
title:"添加用户操作界面", //对话框标题
position:"center",//对话框弹出的位置 top left right center bottom 默认是center
width:400, //对话框宽度
height:330, //对话框高度
resizable:false, //是否可以改变大小操作 默认true
});
//触发连接的事件 当点击连接打开一个对话
$("#dialog_link").click(function (){
//open参数 作用:打开对话框
$("#dialog").dialog("open");
});
});
</script>
</head>
<body>
<table id="table2" width="600" border="1" style="background-color:#9F0;" cellpadding="0" cellspacing="0">
<caption>学生信息</caption>
<tr style="background-color:#F7B64A">
<th>姓名</th>
<th>手机</th>
<th>职位</th>
</tr>
</table>
<br />
<a href="#" id="dialog_link"><span></span>添加</a>
<!--div对话框 $("#dialog").dialog();它就成了一个对话框 在页面中就会隐藏-->
<div id="dialog" align="center">
<br />
姓名:<input type="text" id="name" name="name" /><br /><br />
手机:<input type="text" id="phone" name="phone" /><br /><br />
职位:<input type="text" id="zhiwei" name="zhiwei" /><br /><br />
</div>
</body>
</html>
<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="../../include/jquery.js"></script>
<script language="javascript" type="text/javascript" src="../../include/jquery-ui-1.8.18.custom.min.js"></script>
<link rel="stylesheet" href="../../include/css/ui-lightness/jquery-ui-1.8.18.custom.css" />
<script>
$(function (){
//注册对话框
$("#dialog").dialog({
//设置对话框打开的方式 不是自动打开
autoOpen:false,
show:"blind",
hide:"explode",
modal:true,
buttons:[
{
text:"添加",
click:function (){
//获取姓名
var name=$("input[id=name]").val();
//获取专业
var zhuanye=$("input[id=phone]").val();
//手机
var phone=$("input[id=zhiwei]").val();
var $tr=$("<tr style='background-color:#FFF'><td align='center' width='200'>"+name+"</td><td align='center' width='200'>"+zhuanye+"</td><td align='center' width='200'>"+phone+
"</td></tr>");
$tr.appendTo("#table2");
$(this).dialog("close");
}
},{
text:"取消",
click:function(){
$(this).dialog("close");
}
}
],
closeOnEscape:false, //是否esc
title:"添加用户操作界面", //对话框标题
position:"center",//对话框弹出的位置 top left right center bottom 默认是center
width:400, //对话框宽度
height:330, //对话框高度
resizable:false, //是否可以改变大小操作 默认true
});
//触发连接的事件 当点击连接打开一个对话
$("#dialog_link").click(function (){
//open参数 作用:打开对话框
$("#dialog").dialog("open");
});
});
</script>
</head>
<body>
<table id="table2" width="600" border="1" style="background-color:#9F0;" cellpadding="0" cellspacing="0">
<caption>学生信息</caption>
<tr style="background-color:#F7B64A">
<th>姓名</th>
<th>手机</th>
<th>职位</th>
</tr>
</table>
<br />
<a href="#" id="dialog_link"><span></span>添加</a>
<!--div对话框 $("#dialog").dialog();它就成了一个对话框 在页面中就会隐藏-->
<div id="dialog" align="center">
<br />
姓名:<input type="text" id="name" name="name" /><br /><br />
手机:<input type="text" id="phone" name="phone" /><br /><br />
职位:<input type="text" id="zhiwei" name="zhiwei" /><br /><br />
</div>
</body>
</html>
相关文章推荐
- jQuery实现弹窗动态添加用户信息【详细注解】
- jQuery实现用户信息表格的添加、删除操作
- jquery实现弹窗效果与表格中信息的添加
- jquery 简短几句代码实现给元素动态添加及获取提示信息
- jquery依然简短几句代码实现给元素动态添加及获取提示信息
- jquery 简短几句代码实现给元素动态添加及获取提示信息
- jQuery实现用户信息表格的添加和删除功能
- java通过nginx+apache tomcat接收用户头像图片上传,实现网站动态和静态域名访问图片的详细教程
- “MVC+Nhibernate+Jquery-EasyUI” 信息发布系统 第四篇(用户管理功能的实现)
- jQuery的cookie插件实现保存用户登陆信息
- PHP+Mysql+jQuery实现动态展示信息
- jQuery实现表格行和列的动态添加与删除方法【测试可用】
- jquery与DataGrid实现点击列名显示/隐藏详细信息
- jQuery实现手风琴效果【详细注解】
- jQuery动态添加.active 实现导航效果代码思路详解
- jquery实现动态添加控件,删除控件,页面性能优化
- Jquery实现无限级树状结构并动态添加增删改等编辑功能
- jQuery实现的简单动态添加、删除表格功能示例
- jQuery动态添加删除select项(实现代码)
- 以用户登录、注册、添加删除修改为例,解析jdbcTemplate使用方式以及spring注解实现CRUD