ajax|rss| Refresh | no refresh | download
rss.js
[Copy this code]code:
<!--
//control ID
function GetId (objid) {
return document.getElementById (ObjID)
}
//link corresponding 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 the number of refreshes
var Num=math.floor (Math.random () *100);
//define address parameters
url = myurl+ "? id=" +num;
//defined as Asynchronous transfer mode
xmldoc = false;
XMLHTTP classes that need to be created when
//mozill,safari and other browsers
if (window. XMLHttpRequest) {
xmldoc = new XMLHttpRequest ();
if (xmldoc.overridemimetype) {
xmldoc.overridemimetype (' text/xml ');
}
}
XMLHTTP class created when
//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 be returned
when creating XMLHTTP class
if (! xmldoc) {
return false;
}
//Call 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!" "
}
}
//Status detection
function CheckState () {
var response = xmldoc.responseXML.documentElement;
btnsty ("Loadifo", "block")
//Receive full server response
if (xmldoc.readystate = = 1) {
getId ("Loadifo"). InnerHTML = "Connection 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 Showdiv area of the page
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;
}
//Recordset Total
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 the variable that receives the node information that points to each element
var titlenode,linknode,categorynamenode,authornode,pubdatenode,descriptionnode
//define variables to 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= ""
//use for loop to generate list information
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 values into the string that produces the table
Listchar + = "<h5><a href=" "+linkv+" ' target= ' _blank ' > ' +titlev+ ' </a></h5><span> hair Table time: "+pubdatev+" </span><div class= ' article ' > "+descriptionv+" </div><div class= ' bottom ' > Article Category: "+categoryv+" <a href= ' "+adminlinkv+" ' target= ' _blank ' > Author: "+authorv+" </a></div> ";
}
//To output the generated table to the page div element
getId ("Prolist"). InnerHTML = Listchar;
Listen ("MAINBG")
}
//Browser fallback part
//rewrite Ifream link, browser fallback key
function savestate (message) {
var hisfrm = getId ("Historyframe")
hisfrm.src = "blank.html?" +message
}
//Detection 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 part
//Removal 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 ())
}
}
//-->
index.html file
[Copy this code]code:
<! 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 "/>
<title>ajax Primary Application-rss no flush aggregator (RC 060221) </title>
<style type= "Text/css" >
<!--
@import url ("Read.css");
-->
</style>
<script type= "Text/javascript" src= "Rss.js" ></script>
</head>
<body>
<div class= "title" > Ajax Primary Application-rss no flush aggregator
<div class= "Close" id= "Clobar" > Closing sidebar </div>
</div>
<div class= "Body" >
<div class= "sidebar" id= "sidebar" >
<div class= "Spacecla" >
<!--Add the connection you need here in the same format-->
<a href= "javascript:ent (' Clear ');" > Hu Dongping personal space </a><br/>
<a href= "javascript:ent (' A-fei ');" >om-space</a><br/>
<a href= "javascript:ent (' Ryanxia ');" >ryan graphics</a><br/>
<a href= "javascript:ent (' Awflasher ');" > Alive. </a><br/>
<a href= "javascript:ent (' Seles ');" >seles Space </a><br/>
<a href= "javascript:ent (' Wawa ');" >wawa-fairy ' s blog</a><br/>
<a href= "javascript:ent (' dreammx ');" > The Prague </a><br/>
of the Great lazy Man
<a href= "Javascript:setlist (12);" > Debug mode </a><br/>
</div>
<div class= "Special" >
<div class= "Spetit" > Special Thanks:</div>
<br/>
<h4><a href= "#" >LT</a></h4>
-so far, the reason I can do what I think I like, is entirely because of LT to my strong background support. So I can strongly despise all unfairness, because the cause of injustice is always a person, and this person is usually the kind of too self-righteous garbage. <br/>
<br/>
<h4><a href= "http://www.ryanxia.com" target= "_blank" > Shari </a></h4>
-he took me into the web design this magical field, and let me recognize the CSS, from now on I entered a world full of miracles. Although he cannot work with us for some reason, his enlightenment to me will be remembered forever! <br/>
<br/>
<h4><a href= "#" > Zhang Tianji </a></h4>
If one day I become a good program designer, then his credit should be the biggest, and always take the trouble to explain some very retarded questions, but because of this spirit, I got into the design of the door, let me benefit for life! The concept of Ajax is what he conveys to me. <br/>
</div>
</div>
<div class= "main" id= "main" >
<div class= "Maintit" id= "ListNum" ></div>
<div class= "Nonetab" ></div>
<div class= "MAINBG" id= "prolist" >
<h5><a href= "#" > Use Help information </a></h5>
<span> Publishing Time:2006.02.21</span>
<div class= "article" > if you see these words, I think you may be in trouble! Take a look at some of the help information given below to see if there is anything you need! </div>
<div class= "Bottom" > <a href= "#" > Author: Hu Dongping </a> </div>
<h5><a href= "#" > Help </a></h5>
<span> Publishing Time:2005.02.21</span>
<div class= "article" > This example for individual original, if you want to reprint, please contact the author qq:100829912<br/>
<br/>
1, if you have been looking at this page, nothing appears: <br/>
<br/>
please follow the steps (Tools-Internet Options-security-Custom level-access to data resources through domain-enabled)! <br/>
because this works is to familiarize people with the key features of Ajax, so this problem will occur. <br/>
<br/>
If still not, then you need to check your browser, because of time, I only in IE6 SP1 test, other browsing has not tried, but it is estimated that in other browsers will certainly have some problems, after all, the new technology still need time to support. <br/>
<br/>
2, hopefully, when you see this code, you will like Ajax technology, this example is a very basic application, but the author also paid a certain amount of time and energy, I hope you can respect the work of the author, if you need to use it for free, but it is best not for commercial purposes, And can indicate the source of reprint, thank you! </div>
<div class= "Bottom" > <a href= "#" > Author: Hu Dongping </a> </div>
</div>
</div>
</div>
<div class= "Footer" > Hu Dongping personal Space © reprint shall be marked with the source <br/>
<a href= "http://blog.cnrui.cn" target= "_blank" >copyright by clear Online space</a> </div>
<!--hint window-->
<div id= "Loadifo" style= "Display:none" ></div>
<iframe id= "Historyframe" style= "Display:none" src= "blank.html" ></iframe>
</body>
</html>
read.css
[Copy this code]code:
Body {
margin:0px;
padding:0px;
font-size:9pt;
}
h4 {
font-size:9pt;
Display:inline;
}
h5 {
Display:inline;
margin-left:10px;
}
span {
margin-left:20px;
color: #666;
}
a {
Text-decoration:none;
color: #900;
}
a:hover {
Color: #F90;
}
. title{
filter:progid:DXImageTransform.Microsoft.Gradient (startcolorstr= "#0099FF", endcolorstr= "#003366", Gradienttype= "0");
height:30px;
Font-weight:bold;
color: #FFF;
padding-top:20px;
padding-left:20px;
border-bottom:2px solid #FFF;
}
. Close {
Float:right;
margin-right:50px;
Cursor:pointer;
}
. Body {
Clear:both;
width:1002px;
}
. Sidebar {
width:200px;
Float:left;
top:20px;
padding-top:10px;
filter:progid:DXImageTransform.Microsoft.Gradient (startcolorstr= "#0066CC", endcolorstr= "#FFFFFF", Gradienttype= "0");
Text-align:center;
}
. Spacecla a{
Font-weight:bold;
color: #E1F1FF;
Text-decoration:none;
Float:left;
width:120px;
padding:5px 5px 3px;
border-bottom:1px dashed #6FF;
}
. Spacecla a:hover{
color: #FFF;
background: #09F;
}
. Special {
margin-top:50px;
width:150px;
color: #666;
line-height:15px;
padding-top:5px;
padding-bottom:5px;
Text-align:left;
}
. spetit {
Font-weight:bold;
color: #FFFFFF;
border-bottom:2px solid #EEE;
}
. Spacecla {
width:150px;
}
. Special a {
color: #000;
}
. nonetab {
height:10px;
background: #EEE;
}
. Main {
width:800px;
Float:right;
}
. maintit {
background: #000;
height:17px;
color: #FFF;
Text-align:center;
padding-top:3px;
}
. MAINBG {
background: #EEE;
Float:left;
width:100%;
Overflow:hidden;
}
. mainbg2 {
background: #EEE;
Float:left;
width:100%;
Filter:alpha (opacity=30);
}
. Article img {
border-width:0px;
Border-style:none;
}
. Article {
padding:5px;
Text-indent:2em;
border-top:1px solid #06F;
margin-left:10px;
}
. Bottom {
filter:progid:DXImageTransform.Microsoft.Gradient (startcolorstr= "#EEEEEE", endcolorstr= "#FFFFFF", Gradienttype= "1");
height:13px;
Text-align:right;
padding-right:20px;
padding-top:3px;
margin-bottom:10px;
}
. Footer {
height:30px;
Filter:progid:DXImageTransform.Microsoft.Gradient (startcolorstr= "#0066CC", endcolorstr= "#B9E3FF", gradienttype= " 1 ");
Text-align:center;
padding-top:5px;
line-height:15px;
color: #FFF;
Clear:both;
}
. Footer a {
color: #EEE;
}
#loadifo {
Position:absolute;
top:200px;
width:120px;
background: #F69;
padding:10px;
Filter:alpha (opacity=90);
Text-align:center;
color: #FFF;
border:1px dashed #909;
left:400px;
}
Blank.html
[Copy this Code] CODE:
<script language= "JavaScript" >
function pageLoaded () {
Window.parent.dhtmlHistory.iframeLoaded (window.location);
}
</script>
<body >
</body>