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
相关文档:
1.创建WEB Application工程WebAjax。
2.建立目录文件AjaxCommon.js如下:
// 声明XmlHttpRequest成员变量
var xmlHttpReq_Obj = null;
// 初始化获取XmlHttpRequest对象
///<param>handler :回调函数名</param>
function GetXmlHttpObject(handler) {
var xmlHttpObj = null;
try {
// Microso ......
最近做网站用到了UpProgress控件,所以把遇到的问题和自己的看法写下来,供以后参考,也希望给大家代码帮助。
UpProgress是和UpdatePanel一起使用的。实现效果就是在提交到服务器的时候,显示提示,比如:“数据加载中,请稍微..”给 ......
一、处理ajax请求的jsp文件:auto.jsp
<%@ page contentType="text/html; charset=gb2312" %>
<%
//设置输出信息的格式及字符集
response.setContentType("text/xml; charset=UTF-8");
response.setHeader("Cache-Control","no-cache&q ......
<mce:script type="text/javascript"><!--
var xmlHttp = false;
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e2) {
xmlHttp = false;
}
}
if (!xmlHttp & ......