Home > Backend Development > PHP Tutorial > ajax+php分页

ajax+php分页

WBOY
Release: 2016-06-23 14:34:49
Original
866 people have browsed it

分页应该比较简单的。你就返回一个XML格式的table替换原先的table 就ok.


1,动态删除Table 里面内容技巧,不需要写太多代码,一行:
tb.removeNode(true)

2,动态增加行,除了CreateElement方法,还可以这样比较短小:


<script><br />function addTable(){<br /> var row1 = tb1.insertRow(); <br /> var cell1=row1.insertCell();<br /> var cell2=row1.insertCell();<br /> cell1.innerText="灰豆宝宝";<br /> cell2.innerText="超级大笨狼"<br />}<br /></script> 

3,在DIV中动态增加Table

<script><br />function addTable(){<br /> var tb1 = document.createElement("table");<br /> tb1.border="1px";<br /> var row1 = tb1.insertRow(); <br /> var cell1=row1.insertCell();<br /> var cell2=row1.insertCell();<br /> mydiv.appendChild(tb1);<br /> cell1.innerText="wanghr100";<br /> cell2.innerText="panyuguang962"<br />}<br /></script>



4,在DIV中删除Table,简单只要Div.innerHTML=""就可以。

以上是部分实用相对短小的代码,当然有其他各种办法实现,不过一般都比上面的长,比如组合使用DIV对象的insertAdjacentHTML 方法等,在不同需要下使用不同方法,前提是研究好浏览器模型 的各种对象的方法属性。尤其是熟悉CSS+HTML就会做的很酷。就JS语言本身来说要求不高。

以下是以Document对象为例,相关方法有:

Method Description
attachEvent
createAttribute   
createComment  
createDocumentFragment 
createElement 
createEventObject 
createStyleSheet 
createTextNode 
detachEvent
getElementById  
getElementsByName 
getElementsByTagName
mergeAttributes
recalc
write  
writeln 
以DIV对象为例相关方法有:
addBehavior 
appendChild 
applyElement 
attachEvent
clearAttributes
cloneNode
contains 
detachEvent
getAdjacentText   
getAttribute  
getAttributeNode
getElementsByTagName
hasChildNodes 
insertAdjacentElement 
insertAdjacentHTML 
insertAdjacentText
insertBefore
mergeAttributes
normalize
removeAttribute 
removeAttributeNode  
removeBehavior
removeChild
removeExpression
removeNode
replaceAdjacentText
replaceChild
replaceNode
setActive
setAttribute
setAttributeNode
setExpression  

 

异步调用

 


 
 

异步调用 xmlhttp 取后台数据,你可以搞成PHP的



 dim i, xml
xml = ""
xml = xml & ""
for i = 1 to 50
 xml = xml & "记录" & i & ""
next
xml = xml & "
"
response.ContentType = "text/xml"
response.write xml
%>

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template