<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Title</title>
<style>
.hide {
display: none;
} .modal {
position: fixed;
top: 50%;
left: 50%;
width: 500px;
height: 400px;
margin-left: -250px;
margin-top: -250px;
background-color: #eeeeee;
z-index: 10;
} .shadow {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0.6;
background-color: black;
z-index: 9;
}
</style>
</head>
<body>
<a onclick="add();">添加</a>
<table border="1" id='ta'>
<tr>
<td id="tt" target="hostname">1.1.1.11</td>
<td target="port">80</td> <td>
<a class="edit">编辑</a> | <a class="del_model">删除</a>
</td>
</tr>
<tr>
<td target="hostname">1.1.1.12</td>
<td target="port">80</td>
<td>
<a class="edit">编辑</a> | <a class="del_model">删除</a>
</td>
</tr>
<tr>
<td target="hostname">1.1.1.13</td>
<td target="port">80</td>
<td>
<a class="edit">编辑</a> | <a class="del_model">删除</a>
</td>
</tr>
<tr>
<td target="hostname">1.1.1.14</td>
<td target="port">80</td>
<td>
<a class="edit">编辑</a> | <a class="del_model">删除</a>
</td>
</tr>
</table>
<div class="modal hide">
<div>
<input name="hostname" type="text"/>
<input name="port" type="text"/> </div>
<div>
<input type="button" value="取消" onclick="cancel();"/>
<input id="confirm" type="button" value="确定" />
</div>
</div>
<div class="shadow hide"></div>
<script src="jquery-1.12.4.js"></script>
<script>
function add() {
$(".modal,.shadow").removeClass('hide')
}
function cancel() {
$(".modal,.shadow").addClass('hide')
$('.modal input[type="text"]').val("")
// 点击取消按钮就会清空文本框的内容
} $(".edit").click(function () {
$('.modal,.shadow').removeClass('hide')
var res = $(this).parent().prevAll()
// 循环每一个td
res.each(function () {
// 获取hostname属性
var host_name = $(this).attr('target');
// 获取内容1.1.1.11
var res = $(this).text();
// $('.modal input[name="hostname"]')
// 字符串拼接
var a = '.modal input[name="';
var b = '"]'
var tmp = a + host_name + b
$(tmp).val(res) }) // .val()进行赋值
})
$('.del_model').click(function () {
$(this).parent().parent().remove(); })
function confirm_model() {
var tr = document.createElement('tr');
var td1 = document.createElement('td');
td1.innerHTML='1.1.1.1';
var td2 = document.createElement('td');
td2.innerHTML='8001';
$(tr).append(td1);
$(tr).append(td2);
$('#ta').append(tr);
$(".modal,.shadow").addClass('hide'); } </script>
</body>
</html>

python :模态对话框的更多相关文章

  1. MFC编程 | 非模态对话框的定义

    因为课程需要,会用到MFC编程,所以讲一些经验总结下,以便日后使用查询. // 非模态对话框的定义 // 通过单文档菜单调用一个非模态窗口 1.首先在工程里插入一个对话框(如:IDD_DLG_TEST ...

  2. bootstrap dialog 使用模态对话框

    bootstrap3-dialog 使用模态对话框 <div class="modal fade"> <div class="modal-dialog& ...

  3. 【原创】WinForm 模态对话框

    今天解决的一个问题,记录下,以备后用. 问题描述:WinForm程序有超时自动退出功能,但是有些模态对话框不关掉的话会退出失败,原因(猜测): 程序倒计时用的System.Windows.Forms. ...

  4. 关于easyUI的模态对话框

    本文版权归博客园和作者吴双本人共同所有,转载和爬虫请注明原文地址.博客园蜗牛cnblogs.com/tdws 会用easyUI的模态对话框会是我们的开发更加简洁,只需下载这个插件,把需要的文件拖到项目 ...

  5. 自定义AlertView实现模态对话框

    在Windows应用程序中,经常使用模态(Model)对话框来和用户进行简单的交互,比如登录框.在IOS应用程序中,有时我们也希望做同样的事情.但IOS的UI库中,没有模态对话框,最接近那个样子的应该 ...

  6. MFC编程入门之十二(对话框:非模态对话框的创建及显示)

    上一节讲了模态对话框及其弹出过程,本节接着讲另一种对话框--非模态对话框的创建及显示. 非模态对话框显示后,程序其他窗口仍然能正常运行,可以响应用户输入,还可以相互切换.上一讲中创建的Tip模态对话框 ...

  7. MFC编程入门之十一(对话框:模态对话框及其弹出过程)

    加法计算器对话框程序大家照着做一遍后,相信对基于对话框的程序有了些解了,有个好的开始对于以后的学习大有裨益.趁热打铁,这一节讲讲什么是对话框和非模态对话框,以及模态对话框怎样弹出. 一.模态对话框和非 ...

  8. MFC学习笔记(一)向模态对话框传递数据

    声明构造函数为2个参数,具有默认参数的参数须放在后面. CDialogDimmer::CDialogDimmer(CString name,CWnd* pParent /*=NULL*/) : CDi ...

  9. Unity3D 调用模态对话框/Unity3D MessageBox

    Unity模态对话框/Unity MessageBox 很多时候,我们需要将Unity的exe产品发布到某一个平台.比如某某斗地主发布到某Q游戏.这时候如果需要调试肿么办.办法无外乎那几个.1:源码调 ...

随机推荐

  1. 掌握Thinkphp3.2.0----SQL查询

    首先,先谈一下对查询的理解:查询的对象是数据库中的数据表,一个或多个:查询的限制就是各种条件或要求:查询的结果=表对象+限制(条件). 对数据表的操作(CRUD)查询是最复杂也是最关键的一步!'SEL ...

  2. 关于sort排序

    JavaScript的数组排序函数 sort方法,默认是按照ASCII 字符顺序进行升序排列.arrayobj.sort(sortfunction);参数:sortFunction可选项.是用来确定元 ...

  3. 用js加密你的重要信息

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  4. ElasticSearchwindow下搭建

    ElasticSearch是一个开源的分布式搜索引擎. 下载 下载地址: https://www.elastic.co/downloads/elasticsearch 当前版本:Elasticsear ...

  5. Linux 升级修改libc gcc 文件名称,导致执行命令失效问题解决

    升级linux文件时,若不小心把文件名给重命名了,结果导致执行所有命令都不识别. 比如我们不小心执行了 mv /lib64/libc.so.6 /lib64/libc.so.6.bak 结果导致所有系 ...

  6. (地址)Spring Data Solr

    http://docs.spring.io/spring-data/solr/docs/1.3.0.RELEASE/reference/html/

  7. lua coroutine for iterator

    背景 前面的文章演示了使用闭包函数实现 状态的迭代器. 本文演示使用 coroutine来产生迭代器的例子. coroutine迭代器例子 -- 遍历二叉树 local binary_tree = { ...

  8. ADC 转换序列暂时难理解

    通常情况下,core文件会包含了程序运行时的内存,寄存器状态,堆栈指针,内存管理信息还有各种函数调用堆栈信息等,我们可以理解为是程序工作当前状态存储生成第一个文件,程序出错的时候理论上都会产生一个co ...

  9. debian bcm43* 无线网卡驱动

    deb http://httpredir.debian.org/debian/ jessie main contrib non-free # apt-get update# apt-get insta ...

  10. JavaWeb-springMVC

    <context:component-scan/> 扫描指定的包中的类上的注解,常用的注解有: @Controller 声明Action组件@Service    声明Service组件  ...