Ajax的无刷新分页
Ajax的无刷新分页
这里以两个文件进行代码显示一个是ajax分页实现的文件,另一个是分页类文件
文件1.ajax_page.php
<script type="text/javascript" language="javascript">
function createXMLHttp()
{
var browser=navigator.appName; //get the current browser
if(browser=="Microsoft Internet Explorer")
{
xmlHttp=new ActiveXObject("Microsoft.XMLHttp"); //if is IE
}
else xmlHttp=new XMLHttpRequest();
}
function changePage(url)
{
xmlHttp.onreadystatechange=newPage;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function newPage()
{
if(xmlHttp.readyState==4)
{
if(xmlHttp.status==200)
{
document.getElementById("newPage").innerHTML=xmlHttp.responseText;
}
}
}
function doPage(url)
{
var xmlHttp=false;
createXMLHttp();
document.getElementById("newPage").innerHTML="正在读取数据...";
changePage(url);
}
</script>
<style type="text/css">
#pageWay{
background-color:#b5d6e6; background-image:url("tab_19.gif"); width:100%; font-size:15px; padding:5px;
}
span{
color:red; font-weight:700;
}
.one{
width:37px; height:15px;
}
.two{
width:43px; height:15px;
}
img{
border:0px;
}
</style>
<div id="newPage">
<?php
include "database.class.php";
include "page.class.php";
$db=new database();
$data_sql="SELECT `exptime`,`realdat`,`predat` from `labrec`";
$data_res=$db->query($data_sql) or die($db->error());
$data_nums=$db->num_rows($data_res); //求出总的数据条数
if($data_nums)
{
&nbs
相关文档:
一:前端js代码,主要负责创建ajax和动态生成区域列表
<script type="text/javascript">
//i始终指向最后一个select
var i=1;
//创建XMLHttpRequest对象
var XMLHttpReq;
&n ......
最近被这个问题困惑了一段时间
问题的由来是这样的:
在pageload事件中,有一行语句对this.Title赋值: this.Title = dir.name;
由dir的name去动态的生成网页的title
这么做并没有什么问题,但是一旦结合了ajax,问题就出现了
有兴趣的朋友可以尝试一下
在pageload中对this.Title赋值,然后在body中写一个updatepanel ......
What is AJAX
This section is for those who have no idea what AJAX is. If you don’t fall into this category, feel free to skip to the next section.
AJAX stands for asynchronous JavaScript and XML. If you see another term XHR, which is shorthand for XML HTTP request, it’s the same thing. ......
在
vs2008为asp.net ajax添加js智能感知
今天找了好久,终于搞清楚了,scriptManager控件支持js智能感知,而从其继承的toolkitScriptManager不支持。至少在
vs2008b2中是这样。
要在js文件中添加asp.net ajax的js智能感知(与scriptManager控件无关),在js文件的开头添加这样一行即可:
//
/<referen ......
在一个小型项目中,我使用了Ajax Extensions中的UpdatePanel控件,在本地调试运行时好的,可以看到ajax的异步刷新效果,但是当发布到安装了.net framework 3.5 sp1的server 2003上去之后,发现ajax效果没有了,也就是说本来的异步提交变成了非Ajax方式的POST,而且没有报告任何错误。
对比开发时和运行 ......