//生成遮罩层
function Mask() { };
//生成默认遮罩
Mask.Open = function () {
$("body").css("overflow", "hidden");
var mask = $(".screenMask");
if (mask.size() < 1) {
$("body").append("
");
showbox = $(".ShowBox");
showbox.append("
" + title + "
");
if (msg != null) {
showbox.append("
正在提交答题信息……
");
}
if (img != null) {
var spt = $("script[path]");
showbox.append("

");
}
}
//屏幕的宽高
var hg = $(window).height();
var wd = $(window).width();
//如果为空,则为浏览器窗口一半宽高
width = width != null && width != 0 && width != "" ? Number(width) : 400;
height = height != null && height != 0 && height != "" ? Number(height) : 110;
//如果宽高小于100,则默认为浏览器窗口的百分比
width = width > 100 ? Number(width) : $("body").width() * Number(width) / 100;
height = height > 100 ? Number(height) : hg * Number(height) / 100;
//样式
showbox.css({ "position": "absolute", "z-index": "2000",
"width": width, "height": height, "background-color": "#fff",
"border": "2px solid #666", "text-align": "center"
});
showbox.find(".ShowBoxTitle").css({ "line-height": "35px",
"font-size": "18px", "margin-bottom": "0px", "margin-top": "10px"
});
showbox.find(".ShowBoxMsg").css({ "line-height": "20px",
"font-size": "14px", "margin-bottom": "10px", "margin-top": "10px"
});
showbox.find(".ShowBoxImg").css({ "margin-top": "2px" });
//位置
showbox.css("top", (hg - showbox.height()) / 2 + $(window).scrollTop());
showbox.css("left", (wd - showbox.width()) / 2);
showbox.show();
}
//生成加载的效果
Mask.Loading = function (height, width) {
Mask.Open();
Mask.ShowBox(height, width, "正在加载试题……", null, "load_024.gif");
}
Mask.LoadingClose = function () {
if ($(".screenMask").size() > 0) $(".screenMask").remove();
if ($(".ShowBox").size() > 0) $(".ShowBox").remove();
$("body").css("overflow", "auto");
}
Mask.Submit = function (height, width) {
Mask.Open();
Mask.ShowBox(height, width, "考试结束", "正在提交答题信息……", "load_016.gif");
}
Mask.SubmitClose = function () {
if ($(".screenMask").size() > 0) $(".screenMask").remove();
if ($(".ShowBox").size() > 0) $(".ShowBox").remove();
$("body").css("overflow", "auto");
alert("交卷成功!");
}
Mask.InResult = function () {
$("#inResultLoading").show();
}
Mask.InResultClose = function () {
$("#inResultLoading").hide();
}