`

消息提示功能

阅读更多

========================================
tip.js:
;(function(){
    $.extend({
        tip: function(msg){
            $("#alert").hide();
            $("#alert").find("span.msg").html(msg);           
            $("#alert").removeClass().addClass("alert alert-success").show();
        },
        error: function(msg){
            $("#alert").hide();
            $("#alert").find("span.msg").html(msg);
            $("#alert").removeClass().addClass("alert alert-error").show();
        }
    });
    $.fn.extend({    
    close: function(){    
    $("#alert").hide();
    }    
    });
})(jQuery);
$(function(){
$("#alert a.close").click(function(){
$(this).close();
});
});

========================================
alert.jsp
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<s:if test="jsonMsg.get('flag')==false">
<div id="alert" class="alert alert-error" >
<a data-dismiss="alert" class="close">×</a>
<strong>系统错误提示!</strong>
<span class="msg"><s:property value="jsonMsg.get('msg')"/></span>
</div>
</s:if>
<s:elseif test="jsonMsg.get('flag')==true">
<div id="alert" class="alert alert-success" >
<a data-dismiss="alert" class="close">×</a>
<strong>系统信息提示!</strong>
<span class="msg"><s:property value="jsonMsg.get('msg')"/></span>
</div>
</s:elseif>
<s:else>
<div id="alert" style="display:none;">
<a data-dismiss="alert" class="close">×</a>
<strong>系统信息提示!</strong>
<span class="msg"><s:property value="jsonMsg.get('msg')"/></span>
</div>
</s:else>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics