用法:
new Ajax().Request(url,cmd,async,method,postString,title)
參數:
url: 請求頁面URL(必填)
cmd: 返回值處理函數(必填)
async: 是否異步 ,(ture|false), 默認true
method: 請求方式,(post|get), 默認get
postString: 請求方式為post時,請求內容
title: 請求內容標題
代碼如下:
// Ajax 封裝 2007-3-13
function createXMLHttpRequest() {
try {
if (window.XMLHTTPRequest) {
return new XMLHttpRequest();
}
else if (window.ActiveXObject) {
return new ActiveXObject("Microsoft.XMLHTTP");
}
}
catch (e) {alert("XMLHttpRequest對象無法創建!請檢查IE安全設置!");}
}
function messageDiv(t)
{
var v = document.createElement("<div>");
v.innerHTML = "<table style=/"width:300px;/" id=message>" +
"<tr style=/"font-size:12px;background-color:#EEEEff;color:#227933;height:20px/">" +
"<td style=/"padding:2px;border-top:1px solid #E1E1E1;border-left:1px solid #E1E1E1;border-bottom:1px solid #818181;border-right:1px solid #A1A1A1/">" +
"<nobr><img src=refresh.gif align=absmiddle> " + t + ",<span id=Span1>連接未初始化...</span></nobr></td></tr></table>";
var l = document.getElementsByName("message").length;
v.style.cssText = "position:absolute;bottom:" + (l*24) + "px;left:0px;display:none";
document.body.appendChild(v);
this.clear = function () {
document.body.removeChild(v);
新聞熱點
疑難解答
圖片精選