重写简易的confirm函数
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="http://code.jquery.com/jquery-3.5.1.min.js"></script>
<title>Title</title>
</head>
<body>
<!-- <div style="position: absolute; width: 300px; height: 100px; margin-left: auto; margin-right: auto; left: 0; right: 0; border: 1px solid #e2e2e2; border-radius: 5px; font-family: YouYuan">-->
<!-- <div style="background-color: deepskyblue; height: 30px; line-height: 30px; border-radius: 5px 5px 0 0; padding-left: 10px">温馨提示</div>-->
<!-- <div style="padding: 10px 5px">这是一条消息</div>-->
<!-- <div id="more" style="display: none">这是更多消息</div>-->
<!-- <div style="position: absolute; bottom: 10%; right: 5%">-->
<!-- <button style="background-color:deepskyblue; border-radius: 5px; width: 50px; height: 30px; padding: 0; margin: 0; border: 1px transparent; outline: none">确定</button>-->
<!-- <button style="border-radius: 5px; width: 50px; height: 30px; padding: 0; margin: 0; border: 1px transparent; outline: none">取消</button>-->
<!-- </div>-->
<!-- </div>--> <button onclick="up()">confirm</button>
</body>
</html> <script> function up() {
var message = "这是展示消息";
myConfirm(message);
} function myConfirm(message) {
var html = ' <div id="popup" style="position: absolute; width: 400px; height: 145px; margin-left: auto; margin-right: auto; left: 0; right: 0; border: 1px solid #e2e2e2; border-radius: 5px; font-family: YouYuan">\n' +
' <div style="background-color: #00bfff; height: 30px; line-height: 30px; border-radius: 5px 5px 0 0; padding-left: 10px">温馨提示</div>\n' +
' <div style="padding: 10px 5px">' + message + '</div>\n' +
' <div id="more" style="display: none; padding: 0px 5px">这是更多消息</div>\n' +
' <div style="position: absolute; bottom: 10%; right: 5%">\n' +
' <button style="background-color:deepskyblue; border-radius: 5px; width: 50px; height: 30px; padding: 0; margin: 0; border: 1px transparent; outline: none" onclick="yes()">确定</button>\n' +
' <button style="border-radius: 5px; width: 50px; height: 30px; padding: 0; margin: 0; border: 1px transparent; outline: none" onclick="no()">取消</button>\n' +
' </div>\n' +
' </div>'; $("body").prepend(html);
} function yes() {
// $("#popup").css({display: "none"})
// if (document.getElementById("more").style.display === "none") {
// $("#more").css({display: "block"});
// $("#popup").css({height: "140px"});
// }else{
// $("#more").css({display: "none"});
// $("#popup").css({height: "100px"});
// }
window.
$("#popup").css({display: "none"});
alert("点击了“确定”");
}
function no() {
$("#popup").css({display: "none"});
alert("点击了“取消”");
}
</script>

重写简易的confirm函数的更多相关文章
- javascript confirm()函数的用法
javascript confirm()函数的用法 confirm():确认消息对话框.用于允许用户做选择的动作.弹出的对话框中包含一确定按钮和一取消按钮. confirm(str) 参数说明: st ...
- 重写Oracle的wm_concat函数,自定义分隔符、排序
oracle中,wm_concat函数是一个聚合函数,和mysql中的group_concat函数类似,不过group_concat函数比较强大,可以定义分隔符和排序,当然所谓强大是相对的,这里假使我 ...
- 重写QSqlTableModel的flags函数实现tableview中某些列不可编辑,某些可以编辑
Qt中使用QsqlTableModel和QTableView来显示数据库的查询结果是非常方便的,但是为了使QTableView中某些了列不可用,就需要重写 Qt::ItemFlags flags(co ...
- [Winform]Cefsharp重写alert与confirm弹窗
摘要 在使用winform内嵌cefsharp浏览本地页面的时候,如果出现alert弹窗,会在标题栏显示页面所在目录.所以想起来重写alert的样式,通过winform的MessageBox进行提示. ...
- 重写Alert和confirm方法去除地址显示
//重写alert方法,去掉地址显示window.alert = function(name){var iframe = document.createElement("IFRAME&quo ...
- js confirm函数 删除提示
<a href="del.php" onclick="return confirm('是否将此留言信息删除?')">删除留言</a>
- JS~重写alter与confirm,让它们变成fancybox风格
插件与系统命令 对于很多JS弹框插件来说,都提供了alter,confirm等功能,如fancybox,Boxy等插件,今天来介绍一下如何将系统的alter和confirm替换成指定插件的alter和 ...
- 用scheme重写Python的三大函数map reduce 和filter
重写过程中,发现这种做法能加深对递归的理解,而且reduce还体现了函数式编程是如何通过参数传递来实现命令式编程中的状态改变的. (define (imap f x . y) (if (null? y ...
- Cef 重写alert与confirm弹窗
在使用form内嵌cef浏览本地页面的时候,如果出现alert弹窗,会在标题栏显示页面所在目录.所以想起来重写alert的样式,通过MessageBox进行提示,或者自己写一个弹窗. 以下代码基于 3 ...
随机推荐
- PHP empty() 函数
empty() 函数用于检查一个变量是否为空.高佣联盟 www.cgewang.com empty() 判断一个变量是否被认为是空的.当一个变量并不存在,或者它的值等同于 FALSE,那么它会被认为不 ...
- 4.15 省选模拟赛 编码 trie树 前缀和优化建图 2-sat
好题 np. 对于20分 显然可以爆搜. 对于50分 可以发现每个字符串上的问号要么是0,要么是1.考虑枚举一个字符串当前是0还是1 这会和其他字符串产生矛盾. 所以容易 发现这是一个2-sat问题. ...
- QDC DAY1
暴毙了,比较自闭的心理,有点崩溃.. LINK:幸福 一道曾经的我肯定能写出来的 但是我心态崩了 所以没有推出来. 当然 还是 我比较垃圾 但同时也不垃圾 ... 求 $T_n =\displayst ...
- EACCES: permission denied,mkdir … npm install 安装依赖问题解决
强哥最近在用hugeGraph图库做二次开发的时候,在打包的时遇到前端项目打包失败的问题: cwebp-bin@4.0.0 postinstall /home/hugegraph/my-hugegra ...
- K近邻算法(二)
def KNN_classify(k, X_train, y_train, x): assert 1 <= k <= X_train.shape[0], "k must be v ...
- 2020牛客暑期多校训练营(第八场)K-Kabaleo Lite题解
K-Kabaleo Lite 题目大意: 给出每种菜品的利润以及碟数,要求我们给每个客人至少一碟菜,要求从1号菜品开始给,给的菜品的号码是连续的,每个客人同号码的菜都只能给一碟.求能招待客人的最大数量 ...
- JS 鼠标放上去滑出内容案例
.sliderbar { width: 200px; height: 40px; position: relative; margin: 0 auto; } .sliderbar span { dis ...
- MySQL回表查询
一.MySQL索引类型 1.普通索引:最基本的索引,没有任何限制 2.唯一索引(unique index):索引列的值必须唯一,但是允许为空 3.主键索引:特殊的唯一索引,但是不允许为空,一般在建表的 ...
- 分享:C语言大礼包(PDF)
链接:https://pan.baidu.com/s/1xpOcT1gRhdumV5MlkC4AFQ 提取码:4kh6
- SSM框架整合Demo
目前项目大都开始采用SSM结构进行搭建,因为涉及项目比较多,新来的需求都是从现有项目中迁移一份出来进行修改,有的时候两个项目差别还是比较大,并不完全需要原有项目的东西,进行删减也是一项费神费时的事情, ...