/**
* 提示信息函数
* @param String sHtmlStr 提示信息html代码
* @param Number sType 提示信息类型 1:仅显示消息,无按钮;2:有按钮,且为按钮绑定事件
* @param Function sBindFunction 为确定按钮绑定的函数
*/
globalObject.showMessage = function(sHtmlStr, sType, sBindFunction) {
var type = sType ? Number(sType) : 1;
var htmlStr = sHtmlStr ? String(sHtmlStr) : "程序猿忘记写参数了,这是个bug,不要在意这些细节。:)";
//信息提示模态框字符串
var modalStr = '<div class="modal fade" id="messageModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h5 class="modal-title"><strong>提示信息:</strong></h5></div><div class="modal-body"><p></p></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">取消</button><button type="button" class="btn btn-primary" id="messageSubmit">确定</button></div></div></div></div>';
//判断是否已经加载模态框字符串
if (!$("#messageModal").attr("class")) {
$(".chat").before(modalStr);
}
switch(type) {
case 1:
default:
$("#messageModal .modal-footer").hide();
$("#messageModal .modal-body > p").html(htmlStr);
break;
case 2:
$("#messageModal .modal-footer").show();
$("#messageModal .modal-body > p").html(htmlStr);
$("#messageModal #messageSubmit").off();
$("#messageModal #messageSubmit").click(sBindFunction);
break;
}
$("#messageModal").modal("show");
}
* 提示信息函数
* @param String sHtmlStr 提示信息html代码
* @param Number sType 提示信息类型 1:仅显示消息,无按钮;2:有按钮,且为按钮绑定事件
* @param Function sBindFunction 为确定按钮绑定的函数
*/
globalObject.showMessage = function(sHtmlStr, sType, sBindFunction) {
var type = sType ? Number(sType) : 1;
var htmlStr = sHtmlStr ? String(sHtmlStr) : "程序猿忘记写参数了,这是个bug,不要在意这些细节。:)";
//信息提示模态框字符串
var modalStr = '<div class="modal fade" id="messageModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-dialog"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button><h5 class="modal-title"><strong>提示信息:</strong></h5></div><div class="modal-body"><p></p></div><div class="modal-footer"><button type="button" class="btn btn-default" data-dismiss="modal">取消</button><button type="button" class="btn btn-primary" id="messageSubmit">确定</button></div></div></div></div>';
//判断是否已经加载模态框字符串
if (!$("#messageModal").attr("class")) {
$(".chat").before(modalStr);
}
switch(type) {
case 1:
default:
$("#messageModal .modal-footer").hide();
$("#messageModal .modal-body > p").html(htmlStr);
break;
case 2:
$("#messageModal .modal-footer").show();
$("#messageModal .modal-body > p").html(htmlStr);
$("#messageModal #messageSubmit").off();
$("#messageModal #messageSubmit").click(sBindFunction);
break;
}
$("#messageModal").modal("show");
}