A netizen's Ajax progress bar shows the cause of the Error

Source: Internet
Author: User

VaR xmldoc = false;

VaR url = "index. aspx"
If (window. XMLHttpRequest)
{
Xmldoc = new XMLHttpRequest ();
If (xmldoc. overridemimetype)
{
Xmldoc. overridemimetype = ('text/xml ');
}
}
Else if (window. activexobject)
{
Xmldoc = new activexobject ("Microsoft. XMLHTTP ");
Try {
Xmldoc = new activexobject ("msxml2.xmlhttp. 3.0 ");
}
Catch (E)
{
Try {
Xmldoc = new activexobject ("Microsoft. XMLHTTP ");
}
Catch (E)
{}
}
}
If (! Xmldoc)
{
Alert ('error, abandon creating an XMLHTTP instance! ');
Xmldoc = false;
}
Xmldoc. Open ("Post", URL, true );
Xmldoc. onreadystatechange = complete;
Xmldoc. Send (null );

Function complete ()
{
VaR Doc = new document;
If (xmldoc. readystate = 0)
{
If (xmldoc. Status = 200)
{
VaR c = Doc. getelementsbytagname ("oloadbar ");
C. style. width = "1px ";

}
}
If (xmldoc. readystate = 1)
{
If (xmldoc. Status = 200)
{
VaR c = Doc. getelementsbytagname ("oloadbar ");
C. style. width = "80px ";

}
}
If (xmldoc. readystate = 2)
{
If (xmldoc. Status = 200)
{
VaR c = Doc. getelementsbytagname ("oloadbar ");
C. style. width = "160px ";

}
}
If (xmldoc. readystate = 3)
{
If (xmldoc. Status = 200)
{
VaR c = Doc. getelementsbytagname ("oloadbar ");
C. style. width = "240px ";

}
}
If (xmldoc. readystate = 4)
{
If (xmldoc. Status = 200)
{
VaR c = Doc. getelementsbytagname ("oloadbar ");
C. style. width = "300px"
Document. Location. href = "index. aspx"

}
}
}
It should be an error here, doc. getelementsbytagname ("oloadbar ");
The result is a set.
Document. getelementbyid

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.