csdn清爽看贴之xmlhttp实现,就已个html文件,

pigo 2005-05-16 02:13:44
把下面的内容保存为html文件,然后打开,在下拉框里选择栏目即可。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language="Javascript">
var xsllistobj="<?xml version=\"1.0\" encoding=\"gb2312\"?>"
+ "<xsl:stylesheet version=\"1.0\" "
+ "xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" "
+ "xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">"
+ " <xsl:output method=\"html\"/>"
+ " <xsl:template match=\"Top\">"
+ " <xsl:apply-templates select=\"Topics\"/>"
+ " </xsl:template>"
+ " <xsl:template match=\"Topics\">"
+ " <xsl:for-each select=\"Topic\">"
+ "<a href=\"\" onclick=\"opentopic('{TopicId}');return false;\"> "
+ "<xsl:value-of select=\"TopicName\"></xsl:value-of></a><br/><br/>"
+ " </xsl:for-each>"
+ " </xsl:template>"
+ "</xsl:stylesheet>";
var xsltopicobj=
"<?xml version=\"1.0\" encoding=\"gb2312\"?>"
+ "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\" xmlns:fo=\"http://www.w3.org/1999/XSL/Format\">"
+ " <xsl:output method=\"html\" encoding=\"GB2312\"/>"
+ " <xsl:template match=\"Topic\">"
+ " <xsl:apply-templates select=\"Issue\"/>"
+ " <xsl:apply-templates select=\"Replys\"/>"
+ "<div align=\"center\">"
+ "<br/> <xsl:apply-templates select=\"Issue/TopicId\"/>"
+ "</div>"
+ " </xsl:template>"
+ " <xsl:template match=\"Issue\">"
+ " <table align=\"center\" width=\"580\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
+ " <tr height=\"25\" bgcolor=\"#CED9FF\">"
+ " <font color=\"#3366CC\">"
+ " 发帖人<xsl:value-of select=\"PostUserName\"/>"
+ " (<xsl:value-of select=\"PostUserNickName\"/>)"
+ " </font>"
+ " </tr>"
+ " <tr>"
+ " <td>"
+ " <xsl:value-of select=\"TopicName\"/>"
+ " </td>"
+ " </tr>"
+ " <tr>"
+ " <tr>"
+ " <td colspan=\"3\" style=\"WIDTH: 570; WORD-WRAP: break-word\">"
+ " <xmp>"
+ " <xsl:value-of select=\"Content\" disable-output-escaping=\"yes\"/>"
+ " </xmp>"
+ " </td>"
+ " </tr>"
+ " </tr>"
+ " </table>"
+ " </xsl:template>"
+ " <xsl:template match=\"Replys\">"
+ " <xsl:for-each select=\"Reply\">"
+ " <table align=\"center\" width=\"580\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
+ " <tr height=\"25\" bgcolor=\"#CED9FF\">"
+ " <td width=\"360\">"
+ " <font color=\"#3366CC\">"
+ " 第<b>"
+ " <xsl:value-of select=\"position()\"/>"
+ " </b>楼 回复人:<b>"
+ " <xsl:value-of select=\"PostUserName\"/>(<xsl:value-of select=\"PostUserNickName \"/>)"
+ " </b> 信誉:<xsl:value-of select=\"credit\"/>"
+ " </font>"
+ " </td>"
+ " <td width=\"120\">"
+ " <xsl:value-of select=\"PostDateTime\"/>"
+ " </td>"
+ " <td width=\"80\">"
+ " 得分:<xsl:value-of select=\"Point\"/>"
+ " </td>"
+ " </tr>"
+ " <tr>"
+ " <td colspan=\"3\" style=\"WIDTH: 570; WORD-WRAP: break-word\">"
+ " <xmp>"
+ " <xsl:value-of select=\"Content\" disable-output-escaping=\"yes\"/>"
+ " </xmp>"
+ " </td>"
+ " </tr>"
+ " </table>"
+ " </xsl:for-each>"
+ " </xsl:template>"
+" <xsl:template match=\"TopicId\"> "
+" <IFRAME name=\"XmlReply\" marginWidth=\"0\" marginHeight=\"0\" "
+" src=\"http://community.csdn.net/Expert/xsl/Reply_Xml.asp?Topicid={.}\" "
+" frameBorder=\"0\" width=\"750\" scrolling=\"no\" height=\"370\"/> "
+" </xsl:template> "
+ "</xsl:stylesheet>";
function load_xmln(obj, xmlobj, xslobj) {
var myxml = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
var myxsl = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
try {
myxml.async = false;
myxml.load(xmlobj)
}
catch (exception) {
alert(exception.description);
obj.innerHTML ='myxml.load '+ exception.description;
}
try {
myxsl.async = false;
myxsl.loadXML(xslobj);
}
catch (exception) {
alert(exception.description);
obj.innerHTML = 'myxsl.load'+exception.description;
}
try {
html = myxml.transformNode(myxsl);
obj.innerHTML = html;
}
catch (exception) {
alert(exception.description);
obj.innerHTML ='transformNode '+ exception.description;
}
}

function openlist(lid) {
var xmlurl='http://community.csdn.net/expert/rooms/small/'+lid+'/forum_'+lid+'_1.xml';
load_xmln(listbody,xmlurl,xsllistobj)
}
function opentopic(topicid) {
var t=topicid.substring(0,4);
var xmlurl='http://community.csdn.net/Expert/topic/'+t+'/'+topicid+'.xml';
load_xmln(htmlbody,xmlurl,xsltopicobj)
}
</script>
<TITLE>CSDN 论坛浏览器客户端 xmlhttp版本--pigo</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="pigo @ csdn ">
</HEAD>
<BODY>
<select onchange="openlist(this.options[this.selectedIndex].value)">
<option value="1404"selected="true"> 请选择栏目
<option value="5406">Java Web Services / XML问题
<option value="1404"> 灌水乐园
<option value="1403" > 程序人生
</select>
<table border="2">
<tr><td>帖子列表</td><td>帖子内容</td></tr>
<tr><td id="listbody" width="150" style="WORD-WRAP: break-word"> </td><td id="htmlbody" valign="top"> </td></tr>
<table/>
</BODY>
</HTML>


由于csdn的回复检查了页面引用,因此只好保留csdn自家的回复页面 :(


...全文
143 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
jFresH_MaN 2005-05-16
  • 打赏
  • 举报
回复
敦促揭帖~~
YuLimin 2005-05-16
  • 打赏
  • 举报
回复
都放出来了,而且是0分,你也真够皮厚的。。。

我打开IE死翘翘了,怎么回事???
pigo 2005-05-16
  • 打赏
  • 举报
回复
参考连接:

http://community.csdn.net/Expert/topic/3955/3955854.xml?temp=.3460657
http://community.csdn.net/Expert/topic/3957/3957646.xml?temp=.9088709

先登录csdn,然后打开这个html文件,就可以使用回复了。
建议在maxthon或者其它多窗口浏览器中使用,因为这些多窗口浏览器中对站点的会话状态是全局的。


23,409

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧