asp ajax新闻评论
Ajax.js
// AJAX类
function AJAXRequest() {
var xmlObj = false;
var CBfunc,ObjSelf;
ObjSelf=this;
try { xmlObj=new XMLHttpRequest; }
catch(e) {
try { xmlObj=new ActiveXObject("MSXML2.XMLHTTP"); }
catch(e2) {
try { xmlObj=new ActiveXObject("Microsoft.XMLHTTP"); }
catch(e3) { xmlObj=false; }
}
}
if (!xmlObj) return false;
this.method="POST";
this.url;
this.async=true;
this.content="";
this.callback=function(cbobj) {return;}
this.send=function() {
if(!this.method||!this.url||!this.async) return false;
xmlObj.open (this.method, this.url, this.async);
if(this.method=="POST") xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlObj.onreadystatechange=function() {
if(xmlObj.readyState==4) {
if(xmlObj.status==200) {
ObjSelf.callback(xmlObj);
}
}
}
if(this.method=="POST") xmlObj.send(this.content);
else xmlObj.send(null);
}
}
前台页面:
<style type="text/css">
#fbpl
{
width:600px;
height:200px;
background-color:#EEEEEE;
}
#fbbt
{
height:30px;
padding-top:5px;
text-align:center;
font-weight:bold;
color:#FF0000;
background-color:#CCCCCC;
}
#fbfm
{
text-align:left;
margin-left:80px;
}
#fbfm ul {
margin:10px;
padding:0px;
}
#fbfm li {
list-style: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
}
#nc
{
width:300;
border:#CCCCCC solid 1px;
}
#content
{
width:350;
height:100;
border:#CCCCCC solid 1px;
}
#anniu
{
height:30px;
text-align:center;
}
.bt
{
background-color:#FFFFFF;
color:#000000;
font-size:12px;
width:60;
height:20;
border:#CCCCCC solid 1px;
}
#pllist
{
width:600px;
background-color:#EEEEEE;
font-size:12px;
}
#pllbt
{
height:30px;
padding-top:5px;
text-align:center;
font-weight:bold;
color:#FF0000;
background-color:#CCCCCC;
}
#plbox
{
font-size:12px;
}
/*
.u {
font-size: 12px;
float:left;
height:25px;
line
相关文档:
<!--#include file="config.asp" -->
<!--#include file="Fun.asp" -->
<%
'数据库管理类
class Datas
'备份
public sub Bk()
Set fso=server.createobject("scripting.filesystemobject")
fso.CopyFile Server.MapPath(SiteDataPath),Server.MapPath(SiteDataBakPath)
......
ASP函数与VBSCRIPT类似,以下举一些常用的函数
Array()
函数返回一个数组
表达式 Array(list)
允许数据类型: 字符,数字均可
实例: <%
Dim myArray()
For i = 1 to 7
Redim Preserve myArray(i)
myArray(i) = WeekdayName(i)
Next
......
1.创建WEB Application工程WebAjax。
2.建立目录文件AjaxCommon.js如下:
// 声明XmlHttpRequest成员变量
var xmlHttpReq_Obj = null;
// 初始化获取XmlHttpRequest对象
///<param>handler :回调函数名</param>
function GetXmlHttpObject(handler) {
var xmlHttpObj = null;
try {
// Microso ......
一、XMLHttpRequest 对象的方法与属性
方 法
描 述
abort()
停止当前请求
getAllResponseHeaders()
把HTTP请求的所有响应首部作为键/值对返回
getResponseHeader("header")
返回指定首部的串值
open("method", "url")
建立对服务器的调用。method参数可以是GET、POST或PUT。 ......