把以下代码更改成VB版的
function Ajax() {
if (typeof (Ajax.initMethod) == "undefined") {
Ajax.prototype.GetHttpRequestObject = function() {
if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) return new XMLHttpRequest();
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { };
return null;
}
Ajax.prototype.EncodeUrlParam = function(param){
var params = param.split('&');
var rp = "";
for(var i = 0;i< params.length;i++){
var nv = params[i].split('=');
if(rp != "") rp += "&";
rp += nv[0] + "=";
rp += encodeURIComponent(nv[1]);
}
return rp;
}
// callback is defined outside with two params
// first param shows that the request complete successfully or not
// second shows the response text
Ajax.prototype.Get = function(url, callback) {
var xmlHttp = Ajax.prototype.GetHttpRequestObject();
if (xmlHttp == null) {
alert("create ajax error");
return;
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == RS_COMPLETE) {
if (xmlHttp.status == 200) callback(true, xmlHttp.responseText);
else callback(false, xmlHttp.responseText);
xmlHttp = null;
}
}
xmlHttp.open("GET", url, true);
xmlHttp.setRequestHeader("Content-Type", "text/html;charset=gb2312");
xmlHttp.send(null);
}
Ajax.prototype.Post = function(url, param, callback) {
var xmlHttp = Ajax.prototype.GetHttpRequestObject();
if (xmlHttp == null) {
alert("create ajax error");
return;
}
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == RS_COMPLETE) {
if (xmlHttp.status == 200) callback(true, xmlHttp.responseText);
else callback(false, xmlHttp.responseText);
xmlHttp = null;
}
}
xmlHttp.open("POST", url, true);
xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=gb2312');
xmlHttp.send(Ajax.prototype.EncodeUrlParam(param));
}
}
Ajax.initMethod = true;
}
[解决办法]
华夏~~~我来接分也~~~~