首頁  >  文章  >  web前端  >  用Jquery重寫windows.alert方法實作思維_jquery

用Jquery重寫windows.alert方法實作思維_jquery

WBOY
WBOY原創
2016-05-16 17:38:291164瀏覽

已經在IE8 , firefox3.0.11 下面測試通過

複製代碼代碼如下:

$.擴充({
includePath: '',
include: 函數(檔案)
{
var files = typeof file == "string" ? [file] : file;
for (var i = 0; i
{
var name = files[i].replace(/^s|s$/g, ""); .split('.');
var ext = att [att.length - 1].toLowerCase();
var isCSS = ext == "css";
var tag = isCSS ? " : "script";
var attr = isCSS ? " type= 'text/css' rel='stylesheet' " : " language='javascript' type='text/javascript' ";
var link = (isCSS ? "href" : "src") "='" $. include路徑名稱"'"
if ($(tag "[" link "]").length == 0) document.write(" " 標籤">");
}
}
});
$.include(['script/jquery.divbox.js','/css/pop_win.css']);
$(document). ready(function()
{
var IsFirstAlert = true;
var AlertQueue = [];
window.alert = showAlert;
var divalert = " " ; ";
$("body").append (divalert);
function showAlert(info)
{
alertQueue.push(info);
if (IsFirstAlert)
{
IsFirstAlert = falsepen; ;
}
}
$("#alertClose").click(function()
{
$('#divAlert').CloseDiv()
if (alertQueue. length > 0)
{
setTimeout(OpenAlert, 150)
}
});
函數OpenAlert()
{
$("#spaAlertMessage"). (alertQueue[0]);
alertQueue.splice(0, 1);
$("#divAlert").OpenDiv();
}
});


註:以上引用js與CSS的jquery插件
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn