4种Alert提示框

 时间:2024-10-20 09:18:30

1、新建html文档。

4种Alert提示框

2、书写hmtl代艨位雅剖码。<center><button onClick="$.罪焐芡拂myAlert('这里是提示框内的内容');">点击弹出提示框</button><br/><br/><button onClick="$.myAlert({title:'Title',message:'message',callback:function(){alert(1)}});">点击弹出提示框(带有callback)</button><br/><br/><button onClick="$.myConfirm({title:'确认框提示标题',message:'确认框提示内容',callback:function(){alert('callback')}})">点击弹出确认框</button><br/><br/><button onClick="$.myToast('提示内容')">点击弹出自动消失的提示</button><br/><br/></center>

4种Alert提示框

3、书写css代码。*{margin: 0;padding: 0;}.clearfix:after{content: '';display: table;width: 100%;clear: both;}.myModa{position: fixed;top: 0;left: 0;bottom: 0;right:0;background: rgba(0,0,0,0.2); }.myModa .myAlertBox{width: 300px;border-radius: 5px;border: 1px solid #d9d9d9;background: #fff;overflow: hidden;margin: 0 auto; }.myModa .myAlertBox h6{background: #f2f2f2;padding: 10px;line-height: 20px;font-size: 16px;text-align: center;}.myModa .myAlertBox p{padding: 20px;line-height: 26px;font-size: 14px;color: #808080;}.myModa .myAlertBox .btn{cursor: pointer; width: 80px;line-height: 36px;border-radius: 5px;text-align: center;font-size: 16px;margin: 0 auto;margin-bottom: 20px; background: #D9D9D9;}.myModa .myAlertBox .col2 .col{width:120px;float: left;}.myModa .myAlertBox .col2 .col .btn{width: 100%;}.myModa .myAlertBox .col2{padding: 0 20px;}.myToast{position: fixed; display: inline-block;padding: 5px 10px;line-height: 24px;font-size: 14px;color: #fff;background:#000; max-width: 300px;_width: expression(this.offsetWidth >300 ? '300px': 'auto' );*width: expression(this.offsetWidth >300 ? '300px': 'auto' );border-radius: 5px;}

4种Alert提示框

4、书写并添加js代码。<script src="js/jquery.min.js"></script><script src="js/myAlert.js" ></script>

4种Alert提示框

5、代码整体结构。

4种Alert提示框

6、查看效果。

4种Alert提示框
  • 奥拉手游永夜国度怎么去
  • 每页显示10条搜索结果怎么设置?
  • 如何用Excel表格制作WIFI图?
  • 每次打开IE8浏览器总是弹出设置画面
  • ProcessOn 如何导入Visio文件
  • 热门搜索
    无烟校园手抄报 小学生安全手抄报图 可爱的中国手抄报 如何制作手抄报 手抄报怎么画 语文手抄报五年级 三年级英语手抄报 低碳生活手抄报图片 诚信手抄报版面设计图 电脑手抄报