//javascript Object: Created By RexLee
function Ajax(url,data){
this.url=url;
this.data=data;
.userAgent.indexOf("MSIE")>0) {
return "MSIE";//IE瀏覽器
}})( );
};
Ajax.prototype={
get:function(){
.browser=='MSIE') {
try{
catch(e){
xmlhttp=new ActiveXObject('msxml2.xmlhttp 🎜> }else{
xmlhttp.onreadystatechange=function(){
result = xmlhttp.responseText;//閉包,且無法採用this.屬性
};
xmlhttp.open('GET',this.url '?' this.data,false);//true 🎜> return result;
},
post:function(){
if(this.browser=='MSIE'){
xmlhttp =new ActiveXObject('microsoft.xmlhttp');
}else{
};
xmlhttp.onreadystatechange=function(){
result = xmlhttp. responseText;//閉包,不能採用this.屬性
};
xmlhttp.open('POST',this.url,false);//需要設定為falseText,否則無法抓取response> xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");//POST中,這句話必須
xmlhttp.send(this.data);
}
};
//var a=new ajax('opp2.js','');
//alert('by GET\n' a.get() )
//alert('by POST\n' a.post());
////////////////////////// /////
window.onload=function(){
document.getElementById("btn").onclick=function(){
.getElementById("t").value;
var a=new Ajax("phpOOP/getPage.php","page=" p);
document.getElementById("box").inininHTML=a. get();
};
}