Function Ajax (){
// Doc. innerHTML = '<span> Loading... </span> ';
/// Create an object
Var xmlhttp;
Try
{
If (window. ActiveXObject ){
/* Do not delete the following comments, which are not comments */
/* @ Cc_on @*/
/* @ If (@ _ jscript_version> = 5)
Try {
Xmlhttp = new ActiveXObject ("Msxml2.xmlhttp ");
} Catch (e ){
Try {
Xmlhttp = new ActiveXObject ("Microsoft. xmlhttp ");
} Catch (e ){
Xmlhttp = false;
}
}
@ End @*/
} Else {
Xmlhttp = new XMLHttpRequest ();
}
If (! Xmlhttp & typeof XMLHttpRequest! = 'Undefined '){
Xmlhttp = new XMLHttpRequest ();
}
}
Catch (e)
{
Alert (e. message );
}
// Alert (xmlhttp );
If (! Xmlhttp)
{
Alert ("your browser does not support xmlhttp objects, so some features cannot be used. We recommend that you use a later version of the browser !! ");
Return;
}
//
/// Function topic
This. getData = function (url, data, dodata)
{
Var verbs = data;
// Alert (data );
Xmlhttp. open ("POST", url, true );
Xmlhttp. onreadystatechange = function (){
If (xmlhttp. readyState = 4 ){
Dodata (xmlhttp );
}
}
Xmlhttp. setRequestHeader ("Content-Length", verbs. length );
Xmlhttp. setRequestHeader ("CONTENT-TYPE", "application/x-www-form-urlencoded ");
Xmlhttp. send (verbs );
}
/////
This. getUrlData = function (url, data, dodata)
{
Xmlhttp. open ("GET", url, true );
Xmlhttp. onreadystatechange = function (){
If (xmlhttp. readyState = 4 & xmlhttp. status = 200 ){
Dodata (xmlhttp );
Status. setStatusShow (false );
}
Else
{
Status. showInfo ("loading ...");
}
}
Xmlhttp. setRequestHeader ("CONTENT-TYPE", "application/x-www-form-urlencoded ");
Xmlhttp. send (null );
}
This. getFormData = function (demo)
{
Alert (demo );
}
/// Function topic
}
/**
* @ Author zxub 2006-06-1
* Status information display class, defined by var Status = new function (), which can be statically referenced
* Generally, it is function Status (). In this way, the methods in the method cannot be referenced statically and must be referenced through objects.
*/
Var Status = new function ()
{
This. statusDiv = null;
/**
* Initialization Status display Layer
*/
This. init = function ()
{
If (this. statusDiv! = Null)
{
Return;
}
Var body = document. getElementsByTagName ("body") [0];
Var div = document. createElement ("div ");
Div. style. position = "absolute ";
Div. style. top = "50% ";
Div. style. left = "50% ";
Div. style. width = "280px ";
Div. style. margin = "-50px 0 0-100px ";
Div. style. padding = "15px ";
Div. style. backgroundColor = "#353555 ";
Div. style. border = "1px solid # CFCFFF ";
Div. style. color = "# CFCFFF ";
Div. style. fontSize = "14px ";
Div. style. textAlign = "center ";
Div. id = "idstatus ";
Body. appendChild (div );
Div. style. display = "none ";
This. statusDiv = document. getElementById ("idstatus ");
}
/**
* Set status information
* @ Param _ message: Information to be displayed
*/
This. showInfo = function (_ message)
{
If (this. statusDiv = null)
{
This. init ();
}
This. setStatusShow (true );
This. statusDiv. innerHTML = _ message;
}
/**
* Set whether the status layer is displayed.
* @ Param _ show: boolean value. true indicates display, and false indicates not display.
*/
This. setStatusShow = function (_ show)
{
If (this. statusDiv = null)
{
This. init ();
}
If (_ show)
{
This. statusDiv. style. display = "";
}
Else
{
This. statusDiv. innerHTML = "";
This. statusDiv. style. display = "none ";
}
}
}
Function GetPosition (element ){
Var result = new Object ();
Result. x = 0;
Result. y = 0;
Result. width = 0;
Result. height = 0;
If (element. offsetParent ){
Result. x = element. offsetLeft;
Result. y = element. offsetTop;
Var parent = element. offsetParent;
While (parent ){
Result. x + = parent. offsetLeft;
Result. y + = parent. offsetTop;
Var parentTagName = parent. tagName. toLowerCase ();
If (parentTagName! = "Table "&&
ParentTagName! = "Body "&&
ParentTagName! = "Html "&&
ParentTagName! = "Div "&&
Parent. clientTop &&
Parent. clientLeft ){
Result. x + = parent. clientLeft;
Result. y + = parent. clientTop;
}
Parent = parent. offsetParent;
}
}
Else if (element. left & element. top ){
Result. x = element. left;
Result. y = element. top;
}
Else {
If (element. x ){
Result. x = element. x;
}
If (element. y ){
Result. y = element. y;
}
}
If (element. offsetWidth & element. offsetHeight ){
Result. width = element. offsetWidth;
Result. height = element. offsetHeight;
}
Else if (element. style & element. style. pixelWidth & element. style. pixelHeight ){
Result. width = element. style. pixelWidth;
Result. height = element. style. pixelHeight;
}
Return result;
}