The XML Code part is a news XML file. If the NBody part contains the XML and Html unrecognized parts, it is included in the DATA representation attachment. I did not perform the test. For reference only
Code
The Code is as follows:
News test 1 News test 1
News test 2 News test 2
News Test 3 News Test 3
News test 4 News test 4
News Test 5 news Test 5
News Test 6 News Test 6
News Test 7 News Test 7
News test 8 News test 8
News test 9 News test 9
JS Code section. Some JavaScript code is relatively simple. Important XML operation functions
The Code is as follows:
// JavaScript
Function bindNew (index)
{
Var List = new Array ();
List = showPage (index );
Var listul ="
"
For (var I = 0; I <List. length; I ++)
{
// Document. getElementById ("listTb"). innerHTML + = List [I] +"
";
Listul + ="
- "+ List [I] +"
";
}
Listul + ="
";
Document. getElementById ("listTb"). innerHTML = listul;
Document. getElementById ("refer"). innerHTML = "";
Var tc = rtnPageCount ();
For (var I = 1; I <= tc; I ++)
{
//
Document. getElementById ("refer"). innerHTML + ="
"+ I +"
";
}
}
Var xmlDoc = new ActiveXObject ("Microsoft. XMLDOM ");
XmlDoc. async = false;
XmlDoc. resolveExternals = false;
XmlDoc. load ("News. xml ");
// Return the news with a fixed ID
Function findNew (newid)
{
Var Domelement = xmlDoc.doc umentElement;
Alert (Domelement );
}
// Returns the connection of the news title after the page.
Var pageSize = 40;
Function showPage (pageIndex)
{
Var Alltt = new Array ();
Alltt = AlltitleLink ();
Var rtLinks = new Array ();
/* Unfinished parts */
Try
{
For (var I = 0; I <pageSize & (pageSize * (pageIndex-1) + I ){
RtLinks [I] = Alltt [pageSize * (pageIndex-1) + I];
}
}
Catch (e)
{Alert ("showPage () method error! ");}
Return rtLinks;
}
// Number of pages after pagination
Function rtnPageCount ()
{
Var countx = getCount ();
If (countx % pageSize = 0)
{
Return countx/pageSize;
}
Else
{
Return countx/pageSize + 1;
}
}
// Number of returned news records
Function getCount ()
{
Var NewRoot = xmlDoc.doc umentElement;
Var AllNews = NewRoot. childNodes;
Return AllNews. length;
}
// Returns a fixed number of news title connections
Function returnNews (count)
{
Var titles = new Array ();
Var j = 0;
NewRoot = xmlDoc.doc umentElement;
AllNews = NewRoot. childNodes;
For (var I = 0; I {
If (I> = allNews. lenth)
{
Titles [j] = "" + allNews [I]. getarrtiles ("name") + "";
J ++;
}
}
Return titles;
}
// Send back the hyperconnections of all news titles
Function AlltitleLink ()
{
Var allttLink = new Array ();
Var NewRoot = xmlDoc.doc umentElement;
Var allNews = NewRoot. childNodes;
For (var I = 0; I {
Var context = allNews [I];
AllttLink [I] = "" + context. getAttribute ("time") + ":" + context. getAttribute ("name") + "";
}
Return allttLink;
}
Some Html code
The Code is as follows:
I hope to help you in your learning work. You are welcome to ask for feedback.