/** * 信息提示框 * @param msg 提示信息 */ function msgAlert(msg) { var htmlStr = "
"; htmlStr += ""+msg+""; htmlStr += "
"; $('body').append(htmlStr); setTimeout(function(){ $('.msgAlert').remove(); },2000); } /** * 信息确认框 * @param msg 要确认的信息 * @param confirmFunc 确定后要执行的代码 * @param cancelFunc 取消后要执行的代码 */ function msgConfirm(msg,confirmFunc,cancelFunc) { var htmlStr = "
"; htmlStr += "
"; htmlStr += "
信息
"; htmlStr += "
"+msg+"
"; htmlStr += "
"; htmlStr += "
确定
"; htmlStr += "
取消
"; htmlStr += "
"; htmlStr += "
"; $('body').append(htmlStr); $(document).on('mouseover', '.confirm', function(){ $(this).css('background','#0E7FB9'); }); $(document).on('mouseout', '.confirm', function(){ $(this).css('background',''); }); $(document).on('mouseover', '.cancel', function(){ $(this).css('background','#0E7FB9'); }); $(document).on('mouseout', '.cancel', function(){ $(this).css('background',''); }); $(document).on('click', '.confirm', function(){ $('.msgConfirm').remove(); $('.shadow').remove(); if(confirmFunc !=undefined){ (confirmFunc)(); } }); $(document).on('click', '.cancel', function(){ $('.msgConfirm').remove(); $('.shadow').remove(); if(cancelFunc !=undefined){ (cancelFunc)(); } }); }