Dtoast作用 : 用来在网页上弹出提示错误内容
·1 .
导入common.js 内有 Dtoast() 或者之间将Dtoast写入js内
function Dtoast(msg, id, time) {
var time = time ? time : 2;
var id = id ? id : '';
$('.ui-toast').html(msg);
var w = $('.ui-toast').width();
if(w < 14) w = msg.length*14;
$('.ui-toast').css('left', $(document).scrollLeft()+($(document).width()-w)/2 - 16);
$('.ui-toast').fadeIn('fast', function() {
setTimeout(function() {
$('.ui-toast').fadeOut('slow', function() {
if(id) $('#'+id).focus();
});
}, time*1000);
});
}
2.
在网页上加入<div class="ui-toast"></div>
3.
加入css样式
<style>
.ui-toast {
height: 300px;
width: 500px;
line-height: 450px;
overflow: hidden;
display: inline-block;
padding: 0 16px;
background: url({DT_SKIN}image/wap_wrong.png) 200px 50px no-repeat
#000000;
opacity: 0.8;
color: #FFFFFF;
border-radius: 15px;
position: fixed;
z-index: 99;
top: 500px;
font-size: 36px;
display: none;
text-align: center;
}
</style>
4.测试
Dtoast("AAAAAAAAAAAAAAAAA");