s+=”</div><div id=’alert_foot’></div></div>”;
$(“body”).append(s);
$(“#scs_alert”).css(“margin-top”,-($(“#scs_alert”).height()/2)+”px”); //使其垂直居中
$(“#scs_alert”).focus(); //获取焦点,以防回车后无法触发函数
position(document.getElementById(‘mask_layer’),0,0);
position(document.getElementById(‘scs_alert’),$(window).width()/2,$(window).height()/2);
if (typeof can == “number”){
//定时关闭提示
setTimeout(function(){
close_info();
},can*1000);
}
function close_info(){
//关闭提示窗口
if(!c_){
$(“#mask_layer”).fadeOut(“fast”,function(){
$(“#scs_alert”).remove();
$(this).remove();
});
c_=true;
}
}
$(“#alert_ok”).click(function(){
close_info();
if(typeof(ok)==”function”)ok();
});
$(“#confirm_ok”).click(function(){
close_info();
if(typeof(ok)==”function”)ok();
});
$(“#confirm_cancel”).click(function(){
close_info();
if(typeof(can)==”function”)can();
});
function modal_key(e){
e = e||event;
close_info();
var code = e.which||event.keyCode;
if (code == 13 || code == 32){if(typeof(ok)==”function”)ok()}
if (code == 27){if(typeof(can)==”function”)can()}
}
//绑定回车与ESC键
if (document.attachEvent)
document.attachEvent(“onkeydown”, modal_key);










