CopyCode The Code is as follows:
Document. write ('<Div id = "loadingg" style = "height: 65px; width: 205px; position: absolute; Z-INDEX: 1000; Border: 3px # fff solid; text-align: center; font-size: 12px; font-family: Arial, Helvetica, sans-serif; color: #660000; Background: #222; opacity :. 7;-moz-opacity :. 7; filter: alpha (opacity = 70); display: none; "> <br/> <font color =" # ff6600 "> <strong> the data is being read, please wait... </strong> </font> <br/> </div> ')
Function showloading ()
{
VaR OBJ = Document. getelementbyid ("loadingg ")
If (obj. style. display! = "")
{
Obj.style.left.pdf (document.doc umentelement. clientwidth-parsefloat (obj. style. width)/2)+document.doc umentelement. scrollleft + "PX ";
Obj.style.topight (document.doc umentelement. clientheight-parsefloat (obj. style. Height)/2)+document.doc umentelement. scrolltop + "PX ";
OBJ. style. Display = "";
} Else {obj. style. Display = "NONE ";}
}
Function $ (ID)
{Return document. getelementbyid (ID );}
Function echo (OBJ, HTML) {$ (OBJ). innerhtml = HTML ;}
Function fopen (OBJ) {$ (OBJ). style. Display = "";}
Function fclose (OBJ) {$ (OBJ). style. Display = "NONE ";}
Function createxmlhttp (){
VaR XMLHTTP = false;
Try {
XMLHTTP = new activexobject ("msxml2.xmlhttp ");
}
Catch (e ){
Try {
XMLHTTP = new activexobject ("Microsoft. XMLHTTP ");
}
Catch (e ){
XMLHTTP = false;
}
}
If (! XMLHTTP & typeof XMLHttpRequest! = 'Undefined '){
XMLHTTP = new XMLHttpRequest ();
If (XMLHTTP. overridemimetype) {// sets the mime category
XMLHTTP. overridemimetype ('text/xml ');
}
}
Return XMLHTTP;
}
Function getdata (URL, obj1, obj2)
{Var XMLHTTP = createxmlhttp ();
If (! XMLHTTP)
{Alert ("your browser does not support XMLHTTP !! ");
Return;
}
Showloading ()
XMLHTTP. onreadystatechange = requestdata;
XMLHTTP. Open ("get", URL, true );
XMLHTTP. Send (null );
Function requestdata ()
{Fopen (obj1 );
// Echo (obj1, "loading data. Please wait ......");
// Alert (XMLHTTP. readystate)
If (XMLHTTP. readystate = 4)
{If (XMLHTTP. Status = 200)
{If (obj1! = Obj2) {fclose (obj1 );};
Echo (obj2, XMLHTTP. responsetext );
Showloading ()
}
}
}
}
Function postdata (URL, OBJ, data)
{Var RND = math. Random ()
VaR XMLHTTP = createxmlhttp ();
If (! XMLHTTP)
{
Alert ("your browser does not support XMLHTTP !! ");
Return;
}
Showloading ()
XMLHTTP. Open ("Post", URL, true );
XMLHTTP. onreadystatechange = requestdata;
XMLHTTP. setRequestHeader ("Content-Type", "application/X-WWW-form-urlencoded ");
XMLHTTP. Send (data );
Function requestdata ()
{Fopen (OBJ );
Echo (OBJ, "submitting data. Please wait ......");
If (XMLHTTP. readystate = 4)
{If (XMLHTTP. Status = 200)
{
Echo (OBJ, XMLHTTP. responsetext );
Reget (RND );
SetTimeout ("echo ('showresult','') ", 2000 );
Echo ('message ','')
Showloading ()
}
}
}
}
Function ltrim (STR)
{
If (Str. charat (0) = "")
{
// If the first character on the left of the string is a space
STR = Str. Slice (1); // remove spaces from the string
// This sentence can also be changed to STR = Str. substring (1, str. Length );
STR = ltrim (STR); // recursive call
}
Return STR;
}
// Remove the spaces on the right of the string
Function rtrim (STR)
{
VaR ilength;
Ilength = Str. length;
If (Str. charat (ilength-1) = "")
{
// If the first character on the right of the string is a space
STR = Str. Slice (0, ilength-1); // remove spaces from the string
// This sentence can also be changed to STR = Str. substring (0, ilength-1 );
STR = rtrim (STR); // recursive call
}
Return STR;
}
// Remove the spaces on both sides of the string
Function trim (STR)
{
Return ltrim (rtrim (STR ));
}
Function f (OBJ)
{
Return trim (eval ("document. ajax_post." + OBJ + ". Value "));
// Return trim ($ (OBJ). value );
}
Function savereply ()
{If (f ("username") = "")
{Alert ("Enter the user name ");
Return false;
}
If (f ("message") = "")
{Alert ("content cannot be blank ");
Return false;
}
VaR validate, password, log_diskey = 0, log_disurl = 0, log_dissm = 0
Validate = ""
Password = ""
If (document. ajax_post.log_diskey.checked ){
Log_diskey = f ("log_diskey ")
}
If (document. ajax_post.log_disurl.checked ){
Log_disurl = f ("log_disurl ")
}
If (document. ajax_post.log_dissm.checked ){
Log_dissm = f ("log_dissm ")
}
If (typeof eval (document. ajax_post.validate ))! = "Undefined "){
If (f ("Validate") = "")
{Alert ("Please enter the Verification Code ");
Return false;
} Else {
Validate = f ("Validate ");
}
}
If (typeof eval (document. ajax_post.password ))! = "Undefined "){
Password = f ("password ");
}
Data = "username =" + escape (f ("username") + "& Password =" + escape (password) + "& validate =" + escape (validate) + "& log_dissm =" + escape (log_dissm) + "& log_disurl =" + escape (log_disurl) + "& log_diskey =" + escape (log_diskey) + "& message =" + escape (f ("message") + "& logid =" + escape (f ("logid ")) + "& Action =" + escape (f ("action "));
// Alert (data );
Postdata ("wbc_blogcomm.asp", "showresult", data );
Return true;
}