jquery实现弹窗效果与表格中信息的添加
2012-03-28 17:31
1771 查看
<!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 type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<script type="text/javascript">
$(function(){
$("#dialog").dialog({
autoOpen:false, //设置对话框打开的方式 不是自动打开
show:"blind", //打开时的动画效果
hide:"explode", //关闭时的动画效果
modal:true, //true遮罩效果 false非遮罩效果
buttons:{
//添加按钮的操作
"确定":function(){
//alert("提交");
$("<tr>"+"<td>"+$("#name").val()+"</td>"+"<td>"+$("#email").val()+"</td>"+"<td>"+$("#password").val()+"</td>"+"</tr>").appendTo("#tab");
//$("#tab").append("<tr>"+"<td>"+$("#name").val()+"</td>"+"<td>"+$("#email").val()+"</td>"+"<td>"+$("#password").val()+"</td>"+"</tr>")
$(this).dialog("close"); //关闭对话框
},
"取消":function(){
//alert("确定取消吗");
$(this).dialog("close"); //关闭对话框
}
},
draggable:true, //true表示可以拖动(默认的),false不可以拖动
//closeOnEscape:false, //是否采用esc键关闭对话框,false不采用。true采用,为默认的
title:"添加用户操作界面", //对话框的标题
position:"center", //对话框弹出的位置(top left right center bottom 默认值是center)
width:400, //对话框的宽度
height:300, //对话框的高度
resizable:true, //是否可以改变的操作 true可以改变尺寸,默认值为true
zIndex:6,
});
//触发连接的事件 当你点击时 连接 打开一个对话
$("#dialog_link").click(function(){
$("#dialog").dialog("open"); //open参数 打开对话框
});
});
</script>
<style>
#tab{
border-collapse:collapse;
}
</style>
</head>
<body>
<h1>Existing Users:</h1>
<table width="500" border="1" id="tab">
<tr style="background-color:#CCC">
<td>Name</td>
<td>Email</td>
<td>Password</td>
</tr>
</table><br /><br /><br /><br />
<a href="#" id="dialog_link">Create new user</a>
<br /><br />
<div id="dialog" title="hi!">
Name:<br />
<input type="text" id="name" /><br />
Email:<br />
<input type="text" id="email" /><br />
password:<br />
<input type="password" id="password" /><br />
</div>
<br /><br />
Use a modal dialog to require that the user enter data during a multi-step process. Embed form markup in the content area, set the modal option to true, and specify primary and secondary user actions with the buttons option.
</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 type="text/javascript" src="js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script>
<link type="text/css" href="css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="stylesheet" />
<script type="text/javascript">
$(function(){
$("#dialog").dialog({
autoOpen:false, //设置对话框打开的方式 不是自动打开
show:"blind", //打开时的动画效果
hide:"explode", //关闭时的动画效果
modal:true, //true遮罩效果 false非遮罩效果
buttons:{
//添加按钮的操作
"确定":function(){
//alert("提交");
$("<tr>"+"<td>"+$("#name").val()+"</td>"+"<td>"+$("#email").val()+"</td>"+"<td>"+$("#password").val()+"</td>"+"</tr>").appendTo("#tab");
//$("#tab").append("<tr>"+"<td>"+$("#name").val()+"</td>"+"<td>"+$("#email").val()+"</td>"+"<td>"+$("#password").val()+"</td>"+"</tr>")
$(this).dialog("close"); //关闭对话框
},
"取消":function(){
//alert("确定取消吗");
$(this).dialog("close"); //关闭对话框
}
},
draggable:true, //true表示可以拖动(默认的),false不可以拖动
//closeOnEscape:false, //是否采用esc键关闭对话框,false不采用。true采用,为默认的
title:"添加用户操作界面", //对话框的标题
position:"center", //对话框弹出的位置(top left right center bottom 默认值是center)
width:400, //对话框的宽度
height:300, //对话框的高度
resizable:true, //是否可以改变的操作 true可以改变尺寸,默认值为true
zIndex:6,
});
//触发连接的事件 当你点击时 连接 打开一个对话
$("#dialog_link").click(function(){
$("#dialog").dialog("open"); //open参数 打开对话框
});
});
</script>
<style>
#tab{
border-collapse:collapse;
}
</style>
</head>
<body>
<h1>Existing Users:</h1>
<table width="500" border="1" id="tab">
<tr style="background-color:#CCC">
<td>Name</td>
<td>Email</td>
<td>Password</td>
</tr>
</table><br /><br /><br /><br />
<a href="#" id="dialog_link">Create new user</a>
<br /><br />
<div id="dialog" title="hi!">
Name:<br />
<input type="text" id="name" /><br />
Email:<br />
<input type="text" id="email" /><br />
password:<br />
<input type="password" id="password" /><br />
</div>
<br /><br />
Use a modal dialog to require that the user enter data during a multi-step process. Embed form markup in the content area, set the modal option to true, and specify primary and secondary user actions with the buttons option.
</body>
</html>
相关文章推荐
- jQuery实现弹窗动态添加用户信息【详细注解】
- jQuery实现用户信息表格的添加、删除操作
- jquery学习之1.22-小练习5-实现添加页面上填写信息到当前页面表格中
- jQuery实现用户信息表格的添加和删除功能
- jQuery实现弹窗动态添加用户信息【详细注解】
- 基于jQuery的为attr添加id title等效果的实现代码
- jquery 简短几句代码实现给元素动态添加及获取提示信息
- jQuery实现简单弹窗遮罩效果
- jquery.fly.js实现添加购物车效果、实现抛物线运动
- JDBC:Servlet返回信息到页面,实现Js弹窗效果
- 使用jQuery实现滑过图片展示信息效果
- jQuery实现用户添加删除,符合条件追加到表格
- 137在搜索框中实现下拉列表效果(扩展知识:表格视图数据源为空数据时显示提示信息)
- jquery-实现的添加个人信息加验证,附完全的注释,相信大家可以看懂
- JS非Alert实现网页右下角“未读信息”效果弹窗
- 圣诞节Merry Christmas给博客添加浪漫的下雪效果基于jquery实现
- jquery实现弹窗效果实例
- Jquery实现简单的表格添加、编辑、删除教程
- jQuery实现HTML表格隔行变色及鼠标悬停变色效果 .