Copy Code code as follows:
JavaScript Document
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 LTrim (str)
{
if (Str.charat (0) = = "")
{
If the first character on the left of the string is a space
str = str.slice (1);//Remove the space 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 space on the right side of the string
function RTrim (str)
{
var ilength;
Ilength = Str.length;
if (Str.charat (iLength-1) = "")
{
If the first character to the right of the string is a space
str = str.slice (0, iLength-1);//Remove spaces from 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 either side of the string
function Trim (str)
{
Return LTrim (RTrim (str));
}
function Sck (s)
{
Return S.replace (/\n/g, "[BR]");
S=s.replace (CHR) &CHR (a), "<br/>");
return s;
}
function f (obj)
{
Return Trim (eval ("document.forms[0].") +obj+ ". Value"));
Return Trim ($ (obj). value);
}
function setf (obj)
{
Return eval ("document.forms[0]." +obj+ ". focus ();");
}
function Show (obj)
{
var s=$ (obj). style;
s.display=s.display== "None"? "": "None";
}
function Echo (obj,html)
{
$ (obj). innerhtml=html;
}
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) {//Set MIME category
Xmlhttp.overridemimetype (' Text/xml ');
}
}
return XMLHTTP;
}
function Getnum (url,obj)
{
var b= "";
var xmlhttp=createxmlhttp ();
if (!xmlhttp)
{
Alert ("Your browser does not support xmlhttp!! ");
Return
}
Xmlhttp.onreadystatechange=requestdata;
Xmlhttp.open ("Get", url,true);
Xmlhttp.send (NULL);
function RequestData () {
if (xmlhttp.readystate==4)
{
if (xmlhttp.status==200)
{
$ (obj). Value=xmlhttp.responsetext;
}
}
}
}
function GetData (URL,OBJ1,OBJ2)
{
var xmlhttp=createxmlhttp ();
if (!xmlhttp)
{
Alert ("Your browser does not support xmlhttp!! ");
Return
}
Xmlhttp.onreadystatechange=requestdata;
Xmlhttp.open ("Get", url,true);
Xmlhttp.send (NULL);
function RequestData ()
{
fopen (OBJ1);
Echo (obj1, "Loading data, please wait ...");
if (xmlhttp.readystate==4)
{
if (xmlhttp.status==200)
{
if (obj1!=obj2) {fclose (obj1);};
Echo (Obj2,xmlhttp.responsetext);
}
}
}
}
function PostData (url,obj,data)
{
var xmlhttp=createxmlhttp ();
if (!xmlhttp)
{
Alert ("Your browser does not support xmlhttp!! ");
Return
}
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 ...");
alert (xmlhttp.readystate);
if (xmlhttp.readystate==4)
{
alert (xmlhttp.status);
if (xmlhttp.status==200)
{
Echo (Obj,xmlhttp.responsetext);
}
}
}
}
function Checkform (obj,id)
{
if (f ("user") = = "")
{
Alert (please leave your name!!) ");
SETF ("user");
return false;
}
if (f ("User"). length>10 && F ("user") <2)
{
Alert ("The name length can only be between 2-10 digits!!") ");
}
if (f ("title") = = "")
{
Alert ("Please fill in the message title!!") ");
SETF ("title");
return false;
}
if (f ("title"). Length>50)
{
Alert ("Sorry, the title is too long!!") ");
SETF ("title");
return false;
}
if (f ("content") = = "")
{
Alert ("Message content cannot be empty!!") ");
SETF ("content");
return false;
}
Data= "user=" +escape (f ("user")) + "&title=" +escape (f ("title")) + "&content=" +escape (document.forms[0). Content.value) + "&reply=" +escape (f ("reply"));
alert (data);
Data= "content=" +escape (Sck (F ("content"));
if (obj== "add")
{
alert (obj);
PostData ("File.asp?action=addsave", "Contentdata", data);
}else if (obj== "reply")
{
PostData ("File.asp?action=replysave", "Contentadmin" +id,data);
}
return true;
}
function Adminlogin ()
{
if ($ ("Adminuser"). value== "")
{
Alert ("Admin account cannot be empty!") ");
$ ("Adminuser"). focus ();
return false;
}
if ($ ("adminpwd"). value== "")
{
Alert ("Admin password cannot be empty!") ");
$ ("adminpwd"). focus ();
return false;
}
Data= "Adminuser=" +escape ($ ("Adminuser"). Value) + "&adminpwd=" +escape ($ ("adminpwd"). Value);
PostData ("File.asp?action=checkadmin", "loginlist", data);
return true;
}
function Adreset ()
{
$ ("Adminuser"). value= "";
$ ("adminpwd"). value= "";
}
function LinkTool ()
{
if ($ ("LinkTool"). innerhtml== "Self-help link")
{
$ ("LinkTool"). Innerhtml= "Friendship link";
GetData ("List.asp?action=addlink", "linklist", "linklist");
}else
{
$ ("LinkTool"). Innerhtml= "Self-Help link";
GetData ("List.asp?action=linklist", "linklist", "linklist");
}
}
function Addlink ()
{
if ($ ("Home"). value== "")
{
Alert ("Site name cannot be empty");
$ ("Home"). focus ();
return false;
}
if ($ ("url"). value== "")
{
Alert ("Web site address cannot be empty!") ");
$ ("url"). focus ();
return false;
}
Data= "Home=" +escape ($ ("Home"). Value) + "&url=" +escape ($ ("url"). value);
PostData ("List.asp?action=linksave", "linklist", data);
return true;
}
function Linkreset ()
{
$ ("Home"). value= "";
$ ("url"). value= "";
}
function Updatepwd ()
{
if (f ("user") = = "")
{
Alert ("Please enter the Admin account number!") ");
SETF ("user");
return false;
}
if (f ("npwd") = = "")
{
Alert ("Please enter the admin password!") ");
SETF ("Npwd");
return false;
}
if (f ("Npwd")!=f ("Npwd1")
{
Alert ("New password and Confirm password are not the same!! ");
SETF ("Npwd");
return false;
}
Data= "user=" +escape (f ("user")) + "&pwd=" +escape (f ("npwd"));
PostData ("List.asp?action=savepwd", "Contentdata", data);
return true;
}
function Updateinfo ()
{
if (f ("Gonggao") = = "")
{
Alert ("The contents of the bulletin cannot be empty!");
SETF ("Gonggao");
return false;
}
if (f ("foot") = = "")
{
Alert ("Copyright information cannot be empty!");
SETF ("foot");
return false;
}
Data= "news=" +escape (document.forms[0].gonggao.value) + "&foot=" +escape (Document.forms[0].foot.value);
PostData ("List.asp?action=infosave", "Contentdata", data);
return true;
}
Package file Download