jquery插件 弹窗效果添加元素

<!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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值