易截截图软件、单文件、免安装、纯绿色、仅160KB

AJAX 表格字段数据排序,点击表头每列排序


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<script type="text/javascript" src="061/xml.js"></script>
<style type="text/css">
.tblStyle
{
border-collapse:collapse;
background:#FFF;
border-top:#000 1px solid;
border-bottom:#000 1px solid;
border-left:#000 0px solid;
border-right:#000 0px solid;
}
.tblStyle th
{
background:#FF9;
text-align:left;
border-bottom:#000 1px solid;
}
.tblStyle td
{
border-collapse:collapse;
border-top:#000 1px solid;
}
</style>
<script type="text/javascript">
<!--
var xmlHttp;
function createXHR(){
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if (!xmlHttp) {
alert('浏览器不支持 XMLHTTP ');
return false;
}
}
function sendRequest(sort){
createXHR();
var url='061-sort.asp?sort='+sort+'&ts='+new Date().getTime();
xmlHttp.open('GET',url,true);
xmlHttp.onreadystatechange=catchResult;
xmlHttp.send(null);
}
function catchResult(){
if (xmlHttp.readyState==4){
if (xmlHttp.status == 200) {
sortTable(xmlHttp.responseXML);
}else{
alert('代码错误:'+xmlHttp.status+'\('+xmlHttp.statusText+'\)');
}
}
}
function sortTable(xmldoc){
var oldobj=document.getElementById('tbl');
var parentDiv=oldobj.parentNode;
var tblObj=document.createElement('table');
var tbody=document.createElement('tbody');
tblObj.setAttribute('width','100%');
tblObj.setAttribute('border','1');
tblObj.setAttribute('cellpadding','2');
tblObj.setAttribute('cellspacing','1');
tblObj.setAttribute('id','tbl');
tblObj.className='tblStyle';
var tblhead=document.getElementById('tblhead');
tbody.appendChild(


相关文档:

Ajax学习笔记

1、创建
XMLHttpRequest
对象的一个实例
var xmlHttp;
 
function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if ( ......

Ajax应用的五个步骤

//Ajax应用的五个步骤
//1.创建XMLHttpRequest对象
var xmlHttp=createXMLHttpRequest();
function createXMLHttpRequest()

 var xmlHttp;
 if(Window.XMLHttpRequest)
 { 
  //IE6以上版本和其他浏览器内置XMLHttpRequest对象
  xmlHttp=new XMLHttpRequest(); ......

ajax repeater分页

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<mce:style type="text/css"><!--
.n{TEXT-DECORATION:none;cursor:pointer} a{color:black} a:hover{color:blue}
.m{TEXT-DECORATION:none;c ......

jQuery Ajax 实例演示

<
script language=
"javascript"
>
 
$(
document)
.ready
(
function
(
)
{
$(
'#send_ajax'
)
.click
(
function
(
)
{
var
params=
$(
'input'
)
.serialize
(
)
;
//序列化表单的值
$.ajax
(
{
url:
'ajax_json.php'
,
//后台处 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号