python :模态对话框
<!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 :模态对话框的更多相关文章
- MFC编程 | 非模态对话框的定义
因为课程需要,会用到MFC编程,所以讲一些经验总结下,以便日后使用查询. // 非模态对话框的定义 // 通过单文档菜单调用一个非模态窗口 1.首先在工程里插入一个对话框(如:IDD_DLG_TEST ...
- bootstrap dialog 使用模态对话框
bootstrap3-dialog 使用模态对话框 <div class="modal fade"> <div class="modal-dialog& ...
- 【原创】WinForm 模态对话框
今天解决的一个问题,记录下,以备后用. 问题描述:WinForm程序有超时自动退出功能,但是有些模态对话框不关掉的话会退出失败,原因(猜测): 程序倒计时用的System.Windows.Forms. ...
- 关于easyUI的模态对话框
本文版权归博客园和作者吴双本人共同所有,转载和爬虫请注明原文地址.博客园蜗牛cnblogs.com/tdws 会用easyUI的模态对话框会是我们的开发更加简洁,只需下载这个插件,把需要的文件拖到项目 ...
- 自定义AlertView实现模态对话框
在Windows应用程序中,经常使用模态(Model)对话框来和用户进行简单的交互,比如登录框.在IOS应用程序中,有时我们也希望做同样的事情.但IOS的UI库中,没有模态对话框,最接近那个样子的应该 ...
- MFC编程入门之十二(对话框:非模态对话框的创建及显示)
上一节讲了模态对话框及其弹出过程,本节接着讲另一种对话框--非模态对话框的创建及显示. 非模态对话框显示后,程序其他窗口仍然能正常运行,可以响应用户输入,还可以相互切换.上一讲中创建的Tip模态对话框 ...
- MFC编程入门之十一(对话框:模态对话框及其弹出过程)
加法计算器对话框程序大家照着做一遍后,相信对基于对话框的程序有了些解了,有个好的开始对于以后的学习大有裨益.趁热打铁,这一节讲讲什么是对话框和非模态对话框,以及模态对话框怎样弹出. 一.模态对话框和非 ...
- MFC学习笔记(一)向模态对话框传递数据
声明构造函数为2个参数,具有默认参数的参数须放在后面. CDialogDimmer::CDialogDimmer(CString name,CWnd* pParent /*=NULL*/) : CDi ...
- Unity3D 调用模态对话框/Unity3D MessageBox
Unity模态对话框/Unity MessageBox 很多时候,我们需要将Unity的exe产品发布到某一个平台.比如某某斗地主发布到某Q游戏.这时候如果需要调试肿么办.办法无外乎那几个.1:源码调 ...
随机推荐
- vi 技巧和诀窍~转IBM
复合搜索 1 #!/bin/ksh 2 # 3 echo "Starting" 4 file=${1} 5 6 echo ${file} 7 8 if [[ ${file} = 1 ...
- (TODO:)下载图片,报错:warning: could not load any Objective-C class information from the dyld shared cache. This will significantly reduce the quality of type information available.
想使用NSInvocationOperation下载图片,然而并没有下载下来, NSData为nil, 还有报错:(打断点就报错) warning: could not load any Object ...
- 配置opencv时计算机显示丢失opencv_world300d.dll如何解决
在自己安装路径里找到opencv_world300d.dll文件: 然后把opencv_world300d.dll文件复制到C://Windows/System32里:
- python写2048小游戏
#!/usr/bin/env python # coding=utf-8 #******************************************************** # > ...
- Python 开平方
#!/user/bin/python3#files :using_sys.pyf = open("filename.txt","r+")num = f.read ...
- SignalR 远程访问并跨域
http://stackoverflow.com/questions/16875228/how-do-i-get-a-signalr-hub-connection-to-work-cross-doma ...
- 正则表达式中的exec和match方法的区别
正则表达式中的exec和match方法的区别 字符串的正则方法有:match().replace().search().split() 正则对象的方法有:exec().test() 1.match m ...
- oracle 常用函数【转】
常用Oracle函数 SQL中的单记录函数 1.ASCII 返回与指定的字符对应的十进制数; SQL> select ascii('A') A,ascii('a') a,ascii('0') z ...
- 编写bat(批处理文件)的优势
以前编写java小程序打成jar包运行的时候非常麻烦,在dos环境先cd进入那个文件夹,再运行java -jar *.jar,自从看了bat以后,发现.bat真的是dos下面运行的好帮手. @echo ...
- VS2013自带的Browser Link功能引发浏览localhost网站时不停的轮询
浏览localhost网站时候不管你打开那个页面它都会不停的轮询.据悉这是VS2013自带的Browser Link功能,里面用到SignalR机制 什么是Browser Link功能,什么是Sign ...