整了我好久了,马上就要上线了,急死了。麻烦大侠们指点迷津。这是我的代码
var xmlhttp;
function putData() {
var continent = document.getElementById("signup_continent").value;
try{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
xmlhttp.onreadystatechange = statechange;
xmlhttp.open("GET","continentToCountry.action?continent="+continent,true);
xmlhttp.Send(null);
}
function statechange() {
if (xmlhttp.readyState == 4) {
alert("b");
if (xmlhttp.status == 200) {
alert("b");
FillData(xmlhttp.responseText);
}
}
}
function FillData(strcountry) {
document.getElementById("signup_nationality").options.length = 0;
var strcountrys = strcountry.split(',');
for (var i = 0; i < strcountrys.length; i++) {
document.getElementById("signup_nationality").add(new Option(strcountrys[i], strcountrys[i]));
}
}
var xmlhttp;
function putData() {
var continent = document.getElementById("signup_continent").value;
try{
xmlhttp= new ActiveXObject('Msxml2.XMLHTTP');
}catch(e){
try{
xmlhttp= new ActiveXObject('Microsoft.XMLHTTP');
}catch(e){
try{
xmlhttp= new XMLHttpRequest();
}catch(e){}
}
}
xmlhttp.onreadystatechange = statechange;
xmlhttp.open("GET","continentToCountry.action?continent="+continent,true);
xmlhttp.Send(null);
}
function statechange() {
if (xmlhttp.readyState == 4) {
alert("b");
if (xmlhttp.status == 200) {
alert("b");
FillData(xmlhttp.responseText);
}
}
}
function FillData(strcountry) {
document.getElementById("signup_nationality").options.length = 0;
var strcountrys = strcountry.split(',');
for (var i = 0; i < strcountrys.length; i++) {
document.getElementById("signup_nationality").add(new Option(strcountrys[i], strcountrys[i]));
}
}
if (xmlhttp.readyState == 4) {
alert("b");
if (xmlhttp.status == 200) {
alert("b");
FillData(xmlhttp.responseText);
}
}
这是问题所在,但我不知道在火狐下如何获取服务器返回来的值呢
但我不知道在火狐下如何获取服务器返回来的值呢
if (xmlhttp.readyState == 4) {
alert("b");
if (xmlhttp.status == 200) {
alert("b");
FillData(xmlhttp.responseText);
}
}
这是问题所在,但我不知道在火狐下如何获取服务器返回来的值呢
但我不知道在火狐下如何获取服务器返回来的值呢
function statechange2() {
alert("222");
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
FillData2(xmlhttp.responseText);
}
}
} 怎么解决啊大侠
var xmlHttp;
function createHttpRequest(){
if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}else if(window.ActiveXObject){
try{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
}
这样试试呢?
整个框架的随便用
经测试我的xmlhttp对象已经获得。问题如上所说,网上说是alert延迟的作用。这样的话假如我不用alert该怎么办呢