jquery插件 弹窗效果添加元素
2012-03-28 21:43
351 查看
<!DOCTYPE html PUBLIC "-//W3C//Dth XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/Dth/xhtml1-transitional.dth">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.th{
background:#F90;
color:#666;
font-size:16px}
.odd{
background-color:#C66;}
</style>
<script language="javascript" type="text/javascript" src="../js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script>
<link rel="stylesheet" href="css/jquery-ui-1.8.18.custom.css">
<!---->
<script language="javascript" type="text/javascript">
//当窗体加载完毕的时候 触发该匿名函数
//$(document) //把dom对象转换成jQuery对象
//$(document).ready(function(){})
$(function (){
$("#dialog").dialog({
autoOpen:false,
show:"bind",
//modal:true,
buttons:[
{
text:"添加",
click:function add(){
var tr=$("<tr></tr>");
var td1="<th>"+$("#name").val()+"</th><th>"+$("#password").val()+"</th><th>"+$("#email").val()+"</th>";
tr.append(td1);
var table=$("#table1");
table.append(tr);
//$(this).dialog("close");
}
},{
text:"取消",
click:function (){
$(this).dialog("close");
}
}
],
draggable:true,
position:"center",
closeOnEscape:false,
width:600,
height:300,
resizable:false,
zIndex:-4,
hide:"explode"
});
$("#dialog_link").click(function (){
$("#dialog").dialog("open");
});
});
</script>
</head>
<body>
<h1>模拟dialog效果</h1>
<!--创建一个连接-->
<table width="500" border="1" id="table1">
<tr>
<th class="th">姓名</th>
<th class="th">密码</th>
<th class="th">邮箱</th>
</tr>
<tr>
<th>张三</th>
<th>123456</th>
<th>9776845943@qq.com</th>
</tr>
<tr>
<th>李四</th>
<th>123456</th>
<th>859486958@qq.com</th>
</tr>
</table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<a href="#" id="dialog_link"class="ui-state"><span>create new tr</span></a>
<!--div 对话框 $("#dialog".dialog())-->
<div id="dialog" align="center">
姓名:<input name="" type="text" id="name"/><p>
密码:<input name="" type="text" id="password"/><p>
email:<input name="" type="text" id="email"/><p>
</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>
<style>
.th{
background:#F90;
color:#666;
font-size:16px}
.odd{
background-color:#C66;}
</style>
<script language="javascript" type="text/javascript" src="../js/jquery.js"></script>
<script language="javascript" type="text/javascript" src="../js/jquery-ui-1.8.18.custom.min.js"></script>
<link rel="stylesheet" href="css/jquery-ui-1.8.18.custom.css">
<!---->
<script language="javascript" type="text/javascript">
//当窗体加载完毕的时候 触发该匿名函数
//$(document) //把dom对象转换成jQuery对象
//$(document).ready(function(){})
$(function (){
$("#dialog").dialog({
autoOpen:false,
show:"bind",
//modal:true,
buttons:[
{
text:"添加",
click:function add(){
var tr=$("<tr></tr>");
var td1="<th>"+$("#name").val()+"</th><th>"+$("#password").val()+"</th><th>"+$("#email").val()+"</th>";
tr.append(td1);
var table=$("#table1");
table.append(tr);
//$(this).dialog("close");
}
},{
text:"取消",
click:function (){
$(this).dialog("close");
}
}
],
draggable:true,
position:"center",
closeOnEscape:false,
width:600,
height:300,
resizable:false,
zIndex:-4,
hide:"explode"
});
$("#dialog_link").click(function (){
$("#dialog").dialog("open");
});
});
</script>
</head>
<body>
<h1>模拟dialog效果</h1>
<!--创建一个连接-->
<table width="500" border="1" id="table1">
<tr>
<th class="th">姓名</th>
<th class="th">密码</th>
<th class="th">邮箱</th>
</tr>
<tr>
<th>张三</th>
<th>123456</th>
<th>9776845943@qq.com</th>
</tr>
<tr>
<th>李四</th>
<th>123456</th>
<th>859486958@qq.com</th>
</tr>
</table>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<a href="#" id="dialog_link"class="ui-state"><span>create new tr</span></a>
<!--div 对话框 $("#dialog".dialog())-->
<div id="dialog" align="center">
姓名:<input name="" type="text" id="name"/><p>
密码:<input name="" type="text" id="password"/><p>
email:<input name="" type="text" id="email"/><p>
</div>
</body>
</html>
相关文章推荐
- 【JQuery插件】元素根据滚动条位置自定义吸顶效果
- Ajax或JS动态添加的元素,Jquery效果不起作用
- jquery弹窗插件colorbox绑定动态生成元素的方法
- jquery插件——点击交换元素位置(带动画效果)
- Html5添加块级元素转换为不同形状的SVG图形的jquery插件教程
- jquery弹窗插件colorbox绑定动态生成元素的方法
- jquery网页元素拖拽插件效果及实现
- Stickup – 轻松实现元素固定效果的 jQuery 插件
- jquery网页元素拖拽插件效果及实现
- 一个JQuery插件,为页面的标题添加动态效果
- 元素视差方向移动jQuery插件-类似github 404页面效果
- jQuery.fly插件实现添加购物车抛物线效果
- jquery实现弹窗效果与表格中信息的添加
- Html5添加三联切换仿3D效果旋转木马jQuery插件教程
- 通过jquery来实现文本框和下拉框动态添加效果,能根据自己的需求来自定义最多允许添加数量,实用的jquery动态添加文本框特效
- jQuery页面元素动态添加后绑定事件丢失方法,非 live
- jQuery实现标签子元素的添加和赋值
- jquery 插件实现图片延迟加载效果代码
- jquery元素分组插件,用于把一连串元素分成多组,如把多个a标签分成多组放入<li>元素中,可以用于简化多图滚动为一个元素滚动,兼容ie6
- 2、jQuery插件之cxSelect城市选择(三级级联效果国际版和国内版)