Recommended: Implement anti-collection of ASP pages I wrote a code to prevent thieves from collecting and communicate with you! Usage: Save a file separately such as (no.asp); use it in the head of the corresponding asp page!--#include file=no.asp -- just add it! % '************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************
ASP Tutorial: A Simple Example About AJAX
Index.asp:
Program code
<html>
<head>
<meta http-equiv=Content-Type content=text/html; charset=gb2312 />
<title>AJAX Simple Application</title>
<script language=javascript>
//Create XMLHttpRequest object
var request = false;
try {
request = new XMLHttpRequest();
} catch (trymicrosoft) {
try {
request = new ActiveXObject(Msxml2.XMLHTTP);
} catch (othermicrosoft) {
try {
request = new ActiveXObject(Microsoft.XMLHTTP);
} catch (failed) {
request = false;
}
}
}
if (!request)alert(Error initializing XMLHttpRequest!);
//Get information
function getInfo() {
var url = info.asp?id= + Math.random();
request.open(GET, url, true);
request.onreadystatechange = updatePage;
request.send(null);
}
//Update the page
function updatePage() {
if (request.readyState == 4) {
if (request.status == 200) {
var response = request.responseText;
document.getElementById(div1).innerText = response;
}else if(request.status == 404) {
alert (Requested URL is not found.);
} else if (request.status == 403) {
alert(Access denied.);
} else
alert(status is + request.status);
}
}
</script>
</head>
<body>
<input name=btn type=button id=btn value=get onclick =getInfo(); />
<div id=div1>The content of the new Div tag is displayed here</div>
</body>
</html>
Info.asp:
Program code
<%
Response.Charset = GB2312 'If you don't set Chinese, you will be garbled
Dim i,arr(9)
arr(0) = Random information 0000000000000000000000
arr(1) = Random information1111111111111111111111111
arr(2) = Random information 22222222222222222222222222222222222222
arr(3) = Random information 3333333333333333333333333333333
arr(4) = Random information 44444444444444444444444444444444444444
arr(5) = Random information 555555555555555555555555555555555555555
arr(6) = Random information 66666666666666666666666666
arr(7) = Random information 77777777777777777777777777777777777777777777777
arr(8) = Random information 888888888888888888888888888
arr(9) = Random information 999999999999999999999999
Randomize
i = Int(10*Rnd())
Response.write arr(i)
%>
Note: AJAX does not require format for the results returned by the server. Just output the results with Response.write.
Share: Interpreting ways to improve MSSQL and ACCESS compatibility As we all know, in ASP, the most commonly used databases are ACCESS and MSSQL. Many programs want to develop into a pattern that can be used by both databases, but due to the inconsistent SQL statements of the two databases, many programs are divided into two unnecessary versions, namely ACCESS and MSSQL versions! In fact, we can judge and recognize the code