首页 > 技术文章 > JS提示框效果

nonoleng 2014-07-08 10:46 原文

提示框 js事件

//提示确认删除

<a href="javascript:if(confirm('确实要删除该内容吗?'))location='http://www.google.com'">弹出窗口</a>


 

 



function tusi(txt, fun) {
  $('.tusi').remove();
   var div = $('<div style="background: url(/images/tusi.png);max-width: 85%;min-height: 77px;min-width: 270px;position: absolute;left: -1000px;top: -1000px;text-align:         center;border-radius:10px;"><span style="color: #ffffff;line-height: 77px;font-size: 23px;">' + txt + '</span></div>');
     $('body').append(div);
      div.css('zIndex', 9999999);
      div.css('left', parseInt(($(window).width() - div.width()) / 2));
      var top = parseInt($(window).scrollTop() + ($(window).height() - div.height()) / 2);
      div.css('top', top);
     setTimeout(function () {
    div.remove();
      if (fun) {
        fun();
      }
        }, 2000);
}

推荐阅读