ajax Repeater 分页例子
一个简单ajax repeater分页demo 改进版. 代码如下..
<a href="javascript:void(0)" mce_href="javascript:void(0)" onclick="getData(0)">1</a>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onclick="getData(1)">2</a>
<a href="javascript:void(0)" mce_href="javascript:void(0)" onclick="getData(2)">3</a>
<mce:script type="text/javascript"><!--
var xmlHttp;
function getData(pIndex) {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
else if (window.XMLHttpRequest)
{
xmlHttp = new XMLHttpRequest();
}
var url = "MyAjaxPager.aspx?index=" + escape(pIndex) + "&num=" + new Date().getTime();
alert(url);
xmlHttp.open("GET", url, true);
xmlHttp.onreadystatechange = ShowRepeaterData;
xmlHttp.send(null);
}
function ShowRepeaterData() {
if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
var gridData = xmlHttp.responseText;
alert(gridData);
var grid = document.getElementById("grid");
grid.innerHTML =gridData;
}
}
// --></mce:script>
//加上这句代码 不然会报控件不在runat="server"错误
public override void VerifyRenderingInServerForm(Control control)
{
//base.VerifyRenderingInServerForm(control);
}
//将repeater数据以html形式输出然后通过前台innerHTML
private string GetHtml(Control control)
{
StringBuilder sb = new StringBuilder();
StringWriter sw
相关文档:
//ajax 获取数据
//脚本
var showResp=0;
function GetXmlHttpObject(handler)
{
var objXmlHttp = null;
if (document.all)//!window.XMLHttpRequest
{
// 创建IE中的XMLHttpRequest对象“XMLHTTP”
var clsids = ["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.5.0","Msxml2.XMLHTTP.4.0","Msxml2.XMLHTTP. ......
前台:
<html>
<head>
<title>Ajax实现无刷新三联动下拉框</title>
<SCRIPT language="javascript">
......
Html代码:
<%@ page language="java" pageEncoding="utf-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>jquery ajax</title>
<link rel="stylesheet" type="text/css" media="screen"
......