熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

Javascript+XML實現分頁的實例

2022-06-13   來源: JSP教程 
xml id=users>
<userGroup>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
  <user id=>
    <userid>user </userid>
    <name>name </name>
  </user>
</userGroup>
</xml>
<table id=datatable datasrc=#users DATAPAGESIZE= width= border=>
<thead>
    <th>數據 userid</th>
    <th>數據 name</th>
    <th>屬性 id</th>
</thead>
<tr>
    <td><span datafld=userid></span></td>
    <td><span datafld=name></span></td>
    <td><span datafld=id></span></td>
</tr>
</table>
<button onclick=documentalldatatablepreviousPage()>Previous Page</button>
<button onclick=documentalldatatablenextPage()>Next Page</button>

  直接復制就行

  如果你的xml在外部則要引用xml

  <xml id=users src=userxml>
</xml>

  如果你要添加超鏈接在(td)文本中則使用

  <a datafld=useid onmouseover=if(thischangged ==  null) { thishref =###aspx?+thishref; thischanged=true}><span datafld=name></sapn></a>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19342.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.