当前位置:网站首页>【JS】利用JS给删除按钮添加提示框
【JS】利用JS给删除按钮添加提示框
2022-08-03 17:17:00 【禾苗码上】
在进行删除操作时,如果有提示框提示用户“是否要删除此条信息”,将会带来更好的体验感。
如图

实现
首先你需要有一个按钮,并为它添加点击事件onclick
<input type="button" onclick="del(你要传入的删除的id);">删除</a>
其次,我们书写点击事件触发的函数,在< head></ head>标签内写JS代码~
<head>
<script type="text/javascript" src="jquery-1.8.3.js"></script>
<script type="text/javascript">
function del(result){
var a = window.confirm("您确定要删除吗?");
if(a==true){
location.href="${pageContext.request.contextPath}/deleteTag?tag.id="+result;
}
}
</script>
</head>
如果用户点击确定,则 a 的值为true,就进行删除操作,否则 a 的值为false,不进行操作。
形参result就是你传入的要删除的信息的id。
location.href 是写你要跳转的删除页面,并在后面拼接你要删除那条记录。
边栏推荐
- 新“妖股”13个交易日暴涨320倍,市值3100亿美元超阿里
- Excuse me this hologres dimension table is cached?How to Finished
- SkyWalking概要介绍
- 生产环境如何删除表呢?只能在SQL脚本里执行 drop table 吗
- Components of communication - the drop-down menu
- TiKV & TiFlash accelerate complex business queries丨TiFlash application practice
- Huawei, Lenovo, BAIC, etc. were selected as the first batch of training bases for "Enterprise Digital Transformation and Security Capability Improvement" by the Ministry of Industry and Information Te
- J9数字虚拟论:元宇宙的潜力:一股推动社会进步的力量
- 数据中台“集存通用治”功能场景说明
- Adobe是什么?
猜你喜欢

一个域名对应多个IP地址

JVS低代码移动端接入方案

security加密解密

CC2530_ZigBee+华为云IOT:设计一套属于自己的冷链采集系统

isNotBlank与isNotEmpty

论文解读(JKnet)《Representation Learning on Graphs with Jumping Knowledge Networks》

融云「音视频架构实践」技术专场【内含完整PPT】

使用deepstream消息发送功能的时候,检测框没有检测标签,No text labels of bboxes displayed with osd for deepstream-test5
![[Unity Starter Plan] Making RubyAdventure01 - Player Creation & Movement](/img/e9/9bba4f7ecee81ae7ce7e492b54ee11.png)
[Unity Starter Plan] Making RubyAdventure01 - Player Creation & Movement

LeetCode·1163.按字典序排在最后的子串·最小表示法
随机推荐
精酿啤酒品牌,过把瘾就死?
论文解读(JKnet)《Representation Learning on Graphs with Jumping Knowledge Networks》
5. Longest Palindromic Substring
【AppCube】零代码小课堂开课啦
fastposter v2.9.0 程序员必备海报生成器
C# 获取文件名和扩展名(后缀名)
FinClip | July 2022 Product Highlights
阿里二面:没有 accept,能建立 TCP 连接吗?
Huawei, Lenovo, BAIC, etc. were selected as the first batch of training bases for "Enterprise Digital Transformation and Security Capability Improvement" by the Ministry of Industry and Information Te
405. Convert a Number to Hexadecimal
383. Ransom Note
CC2530_ZigBee+华为云IOT:设计一套属于自己的冷链采集系统
204. Count Primes
关于 Intel 在 micro-vm 快速启动的探索及实例演示 | 第 36-38 期
怎么在opengauss中进行测试自己添加的新函数的性能(循环n次的运行时间)?
【指针初解】
工程仪器设备在线监测管理系统常见问题和注意事项
CC2530_ZigBee+华为云IOT:设计一套属于自己的冷链采集系统
uniapp 去掉默认导航栏
ThreeJS简介