自定义alert弹框,title不显示域名
2024-08-27 14:29:59
问题: 系统默认的alert弹框的title会默认显示网页域名
解决办法:
(修改弹框样式)
(function() {
window.alert = function(name) {
$(".tip").css("display", "block")
$(".tip .content").html(name)
}
})()
调用:alert(name)
在页面中添加弹框元素,自定义其样式,默认隐藏
注:alert()方法重写,不能传多余参数
(仅去掉网址)
(function(){
window.alert = function(name){
var iframe = document.createElement("IFRAME");
iframe.style.display="none";
iframe.setAttribute("src", 'data:text/plain');
document.documentElement.appendChild(iframe);
window.frames[0].window.alert(name);
iframe.parentNode.removeChild(iframe);
}
})();
alert('试一试');
最新文章
- shell 计算
- Swift语言快速入门
- MUI(2)
- FIR数据广播结构-提高时钟速率
- POJ 2013
- 【Web探索之旅】第三部分第一课:服务器
- source is null for getProperty(null, ";cpmodel";)异常结局
- Java中实例方法、类方法和构造方法
- dubbo线程模型
- Git - 常见错误与解决方案
- Linux中非正常关闭vi编辑器产生swp文件怎么删除
- python 递归函数操作方法
- 27.Docker集群部署
- 20155216 Exp4 恶意代码分析
- EntityFrameWork 图解
- linux tftp 服务
- 创建NuGet包
- C#迭代器、装箱/拆箱、重载等
- animation和transition
- 【洛谷P2014】选课