倒计时

dojo.require("dojo.parser");
dojo.require("dijit.Dialog");

function myAlert(tle, msg, url, callback, html) {
if (dojo.byId("alert")) {
document.body.removeChild(dojo.byId("alert"));
}
if (dijit.byId("confirm")) {
dijit.byId("confirm").destroy();
}

if (!html || html == "") {
html = "<table width=300><tr><td valign='middle' ><img id='alert_img' src='../site/images/ybts.gif'/></td><td align='left' id='alert_msg'></td></tr><tr><td colspan=2 valign='bottom'  align='right'>本窗口将在<span id='show_time'></span>秒内 <a id='alert_close'  href='#'><font color='blue'>返回</font></a></td></tr></table>";
}
var div = document.createElement("div");
div.id = "alert";
div.innerHTML = html;
div.style.display = "none";
document.body.appendChild(div);

dojo.byId("alert_msg").innerHTML = msg;

if (dijit.byId("alert")) {
dijit.byId("alert").destroy();
}
var alertDia = new dijit.Dialog({
title : tle
}, div);
var time = new Timer("show_time");
time.begin(3);
dojo.style(alertDia.closeButtonNode, "visibility", "hidden");
var handle = dojo.connect(dojo.byId("alert_close"), "onclick", function() {
if (url && url != '' && url != null) {
window.location.href = url;
} else {
alertDia.hide();
ajaxAbort(); // 终止ajax异步请求
dojo.disconnect(handle);
if (callback) {
callback(true);
}

}
time.clear();
});
alertDia.show();

}

你可能感兴趣的:(html,Ajax,dojo)