Ajax primary Application-rss No flush aggregator code with download 1th/3 page _ajax related

Source: Internet
Author: User
Tags flush hash
Rss.js
Copy Code code as follows:

<!--
Control ID
function GetId (ObjID) {
return document.getElementById (ObjID)
}
Links corresponding to the array, please indicate reproduced from Http://www.cnrui.cn/blog
function Urlarrary (urlname) {
Switch (urlname) {
Case "Clear":
Return "Http://www.cnrui.cn/blog/feed.asp"
Case "A-fei":
Return "Http://www.a-fei.net/blog/rss.xml"
Case "Ryanxia":
Return "Http://www.ryanxia.com/blog/feedrss2.asp"
Case "Awflasher":
Return "Http://www.awflasher.com/blog/feed.asp"
Case "Seles":
Return "Http://www.cnrui.cn/seles/feedrss2.asp"
Case "Wawa":
Return "http://a-fei.net/wawa/blog/rss2.php"
Case "DREAMMX":
Return "Http://www.dreammx.com/xhyl/feed.asp"
Default
return False
}
}
Side bar control, please specify from Http://www.cnrui.cn/blog reprint
function Closebar (Targetid,objid) {
if (document.getElementById) {
target = GetId (Targetid);
Objsty = GetId (ObjID);
if (Target.style.display = = "None") {
Target.style.display = "";
Main.style.width = "800px";
objsty.innerhtml = "Close Sidebar"
}else{
Target.style.display = "None";
Main.style.width = "100%";
objsty.innerhtml = "Open sidebar"
}
}
}
Load dimmed, annotated from Http://www.cnrui.cn/blog reprint
function Listen (a) {
GetId ("Prolist"). Classname=a;
}
function Btnsty (Objid,objstyle)
{
GetId (objid). style.display = Objstyle
}
Prompt window control
function Ifodis () {
Btnsty ("Loadifo", "none");
}
function SetTime (a) {
SetTimeout (a,1000);
}
function Loadtime () {
GetId ("Loadifo"). InnerHTML = "."
}
Data entry
Function Ent (urlname) {
Window.location.hash = URLName
var Frmurl = SaveState (urlname);//write information to Ifream
var Gamestart = Loadrss (urlname);//ajax Data process
}
XML Data Binding
var xmldoc = false;
function Loadrss (urlname) {
var Myurl = Urlarrary (urlname)
if (Myurl) {
Listen ("mainbg2");
Generate random numbers, while limiting refresh times
var Num=math.floor (Math.random () *100);
Defining Address Parameters
url = myurl+ "? id=" +num;
Defined as asynchronous transfer mode
XmlDoc = false;
XMLHTTP classes that need to be created when browsers such as Mozill,safari
if (window. XMLHttpRequest) {
xmldoc = new XMLHttpRequest ();
if (Xmldoc.overridemimetype) {
Xmldoc.overridemimetype (' Text/xml ');
}
}
XMLHTTP class created in IE browser
else if (window. ActiveXObject) {
try{
xmldoc = new ActiveXObject ("Msxml3.xmlhttp");
}
catch (e) {
try{
xmldoc = new ActiveXObject ("Msxml2.xmlhttp");
}
catch (e) {
try{
xmldoc = new ActiveXObject ("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
}
Cannot create XMLHTTP class when it returns
if (! xmldoc) {
return false;
}
Calling the CheckState function
Xmldoc.onreadystatechange = CheckState;
Xmldoc.open (' Get ', url,true);
Xmldoc.send (NULL);
}else{
GetId ("ListNum"). InnerHTML = "The address you entered is incorrect, please try again!" "
}
}
State detection
function CheckState () {
var response = Xmldoc.responseXML.documentElement;
Btnsty ("Loadifo", "block")
Receive Full server response
if (xmldoc.readystate = = 1) {
GetId ("Loadifo"). InnerHTML = "Connect Server"
}
else if (xmldoc.readystate = 2) {
GetId ("Loadifo"). InnerHTML = "Start Loading Data"
}
else if (xmldoc.readystate = 3) {
GetId ("Loadifo"). InnerHTML = "Loading Data"
SetTime (Loadtime)
}
else if (xmldoc.readystate = 4) {
HTTP Server Response value succeeded
if (Xmldoc.status = = 200) {
Writes the string returned by the server to the page with an ID showdiv area
GetId ("Loadifo"). InnerHTML = "Load Complete"
SetTime (Ifodis)
Num (response)
}
else{
GetId ("Loadifo"). InnerHTML = "error" +xmldoc.status+ "dot here Refresh";
}
}
}
Check data legality
function Trydata (nodename,nodename2) {
try{
var nodev = NodeName.firstChild.nodeValue;
}catch (e) {
try{
var nodev = NodeName2.firstChild.nodeValue;
}catch (e) {
var Nodev = "No information available"
}
}
return Nodev;
}
Total set of records
function num (b) {
try{
var titlenode = b.selectnodes ("//rss/channel/title");
var a = B.getelementsbytagname ("item"). length
Titlev = Trydata (titlenode (0));
GetId ("ListNum"). InnerHTML = "A total of" +a+ "article from:" +titlev;
Setlist (A,B);
}catch (e) {}
}
if (top.location!= self.location) top.location=self.location;


Show list Shows
Defines a variable that receives node information that points to individual elements
var Titlenode,linknode,categorynamenode,authornode,pubdatenode,descriptionnode
Define variables that receive element values
var Titlev,linkv,categorynamev,authorv,pubdatev,descriptionv
Classification aggregation
function setlist (a,b)
{
var progranode = b.getelementsbytagname ("item");
var adminlinknode = b.selectnodes ("//rss/channel/link");
var titlenode = b.selectnodes ("//rss/channel/item/title");
var Linknode = b.selectnodes ("//rss/channel/item/link");
var categorynode = b.selectnodes ("//rss/channel/item/category");
var authornode = b.selectnodes ("//rss/channel/item/author");
var pubdatenode = b.selectnodes ("//rss/channel/item/pubdate");
var descriptionnode = b.selectnodes ("//rss/channel/item/description");
var category2snode = b.selectnodes ("//rss/channel/item/dc:subject");
var author2snode = b.selectnodes ("//rss/channel/item/dc:creator");
var pubdate2snode = b.selectnodes ("//rss/channel/item/dc:date");
var listchar= ""
Generate list information using a For loop
for (i=0; i<a; i++)
{
Titlev = Trydata (Titlenode (i))
LINKV = Trydata (Linknode (i))
Categoryv = Trydata (Categorynode (i), Category2snode (i))
Authorv = Trydata (Authornode (i), Author2snode (i))
Pubdatev = Trydata (Pubdatenode (i), Pubdate2snode (i))
Descriptionv = Trydata (Descriptionnode (i))
ADMINLINKV = Trydata (adminlinknode (0))
Loads the resulting element value into a string that produces a table
Listchar + = "}
The div element that prints the generated table to the page
GetId ("Prolist"). InnerHTML = Listchar;
Listen ("MAINBG")
}
Browser fallback section
Rewrite Ifream links, browser fallback focus
function savestate (message) {
var hisfrm = getId ("Historyframe")
HISFRM.SRC = "blank.html?" +message
}
Detect Ifream
Window.dhtmlhistory = {
Iframeloaded:function (newlocation) {
var hash = new String (newlocation.search)
if (hash.length >= 2 && hash.charat (0) = = "?" && hash.substring (1)!=delchar ()) {
hash = hash.substring (1)
Window.location.hash = hash;
var hisfrmdata = Loadrss (hash)
}
}
}
Browser links point to section
Remove symbol, please indicate http://www.cnrui.cn/blog reprint
function Delchar () {
var a = Window.location.hash
return a.substring (1)
}
Window.onload = function () {
if (window.location.hash.length >= 2) {
ENT (Delchar ())
}
}
-->

Current 1/3 page 123 Next read the full text
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.