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
相关文档:
jsp的代码:
<%
@ page contentType
=
"
text/html; charset=GBK
"
import
=
"
java.util.*,com.wehave.hyerp.procurement.domain.Cgsqd
"
%>
<%
@ taglib uri
=
"
struts-html
"
prefix
=
" ......
一:前端js代码,主要负责创建ajax和动态生成区域列表
<script type="text/javascript">
//i始终指向最后一个select
var i=1;
//创建XMLHttpRequest对象
var XMLHttpReq;
&n ......
国内通常的读音为“阿贾克斯”和阿贾克斯足球队读音一样。Web应用的交互如Flickr, Backpack和Google在这方面已经有质的飞跃。这个术语源自描述从基于网页的Web应用到基于数据的应用的转换。在基于数据的应用中,用户需求的数据如联系人列表,可以从独立于实际网页的服务端取得并且可以被动态地写入网页中,给缓慢 ......
Ajax------很多程序员都喜欢玩这个东西,觉得很是高深莫测,而且越是痛苦越钟爱,我发现这是程序员的通病,好像不折磨自己不足以享受这么美好的生活,Ajax很火,确实很火,火到什么程度我已经不大清楚,在当时我学程序的那个年代它甚至超过spring,struts等等主流的框架,天哪微软和SUN都很担心,但是时间证明Ajax仅仅只是个这些程序员 ......
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. ......