js自定义提示框弹窗

需要使用jquery.js

使用方法:

 tip("密码错误!");
 tip("操作成功!",1);

这里写图片描述

这里写图片描述

js代码如下:

<script type="text/javascript"/>
function tip(){var bg = '#E64340'; if(arguments[1]==1){bg = '#1AAD19'};$('_tip').remove();$('body').append("<div class='_tip' style='background:"+bg+";font-size:20px;opacity:0.9;padding:20px 0;text-align:center;width:100%;left:0;top:0;color:#fff;position:fixed;'>" +arguments[0]+"</div>");setTimeout(function(){$('._tip').fadeOut(1000, function() {$(this).remove();});}, 1000);}
</script>

样式二

function tip(){var bg = '#333'; if(arguments[1]==1){bg = '#333'};$('_tip').remove();$('body').append("<div class='_tip' style='z-index:99999;opacity:0.9;text-align:center;width:100%;bottom:20%;position:fixed;'><div style='word-wrap:break-word;color:#fff;max-width:80%;padding:5px 10px;display:inline-block;background:"+bg+";border-radius:7px;font-size:20px;'>" +arguments[0]+"</div></div>");setTimeout(function(){$('._tip').fadeOut(1000, function() {$(this).remove();});}, 1500);}
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值