我有一个链接到我的 html 文件的外部 Javascript 文件。在我尝试使用外部 Javascript 文件之前,定位工作正常。当我在头部链接时,RSS 提要会转到我的页面顶部。我可以将链接放在我的 html 文件中的任何位置,还是必须放在头部。我希望 RSS 提要位于“新闻提要”ID 下。我还为我的页面遗漏了一些信息,因为我只需要显示 div 和 css。
这是我的html代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>GamerZone</title>
<link type="text/css" rel="stylesheet" href="index.css" />
<link rel="shortcut icon" type="icon/ico" href="images/icon.ico" />
<script type="text/javascript" src="rss-feed.js"></script>
</head>
<body>
<div id="allcontent">
<div id="banner">
<a target="_self" href="index.html" title="">
<img src="images/banner.jpg" border="0" alt="GamerZone Banner">
</a>
</div>
<div class="container">
<ul class="nav">
<li class="nav-home">
<a href="index.html">Home</a>
</li>
<li class="nav-games">
<a href="games.html">Games</a>
</li>
<li class="nav-chat">
<a href="chat.html">Chat</a>
</li>
<li class="nav-suggestions">
<a href="suggestions.html">Suggestions</a>
</li>
</ul>
</div>
<div id="newsfeed">
//RSS feed goes here
</div>
<div id="footer">
</div>
</div>
</body>
</html>
这是我的CSS代码:
#allcontent {
width: 1000px;
padding-top: 5px;
padding-bottom: 5px;
background-color: ;
margin-left: auto;
margin-right: auto;
}
#poll {
background-color: white;
float: left;
padding: 0px 5px 5px 5px;
margin: 15px 10px 10px 22px;
font-family: Tahoma;
}
#newsfeed {
padding: 15px;
margin: 0px 10px 10px 10px;
}
这是我的 Javascript 代码:
<!--
rssfeed_url = new Array();
rssfeed_url[0]="http://news.yahoo.com/rss/gaming";
rssfeed_frame_width="500";
rssfeed_frame_height="720";
rssfeed_scroll="on";
rssfeed_scroll_step="6";
rssfeed_scroll_bar="on";
rssfeed_target="_blank";
rssfeed_font_size="14";
rssfeed_font_face="";
rssfeed_border="on";
rssfeed_css_url="http://example.com/newsfeed.css";
rssfeed_title="on";
rssfeed_title_name="";
rssfeed_title_bgcolor="#3366ff";
rssfeed_title_color="#fff";
rssfeed_title_bgimage="http://";
rssfeed_footer="off";
rssfeed_footer_name="rss feed";
rssfeed_footer_bgcolor="#fff";
rssfeed_footer_color="#333";
rssfeed_footer_bgimage="http://";
rssfeed_item_title_length="50";
rssfeed_item_title_color="#666";
rssfeed_item_bgcolor="#fff";
rssfeed_item_bgimage="http://";
rssfeed_item_border_bottom="on";
rssfeed_item_source_icon="off";
rssfeed_item_date="off";
rssfeed_item_description="on";
rssfeed_item_description_length="120";
rssfeed_item_description_color="#666";
rssfeed_item_description_link_color="#333";
rssfeed_item_description_tag="off";
rssfeed_no_items="0";
rssfeed_cache = "7872565d53aadc6c14b4ab1bb3f79bdb";
//-->
(function(){
var a=window;
var b="";
for(i=0;i<a.rssfeed_url.length;i++) {
b=b+"rssfeed[url]["+i+"]="+encodeURIComponent(a.rssfeed_url[i])+"&"
}
var c="http://feed.surfing-waves.com/php/rssfeed.php"+"?"+b+"rssfeed[type]="+(a.rssfeed_type?a.rssfeed_type:"")+"&rssfeed[frame_width]="+a.rssfeed_frame_width+"&rssfeed[frame_height]="+a.rssfeed_frame_height+"&rssfeed[scroll]="+(a.rssfeed_scroll?a.rssfeed_scroll:"")+"&rssfeed[scroll_step]="+(a.rssfeed_scroll_step?a.rssfeed_scroll_step:"")+"&rssfeed[scroll_bar]="+(a.rssfeed_scroll_bar?a.rssfeed_scroll_bar:"")+"&rssfeed[target]="+(a.rssfeed_target?a.rssfeed_target:"")+"&rssfeed[font_size]="+(a.rssfeed_font_size?a.rssfeed_font_size:"")+"&rssfeed[font_face]="+(a.rssfeed_font_face?a.rssfeed_font_face:"")+"&rssfeed[border]="+(a.rssfeed_border?a.rssfeed_border:"")+"&rssfeed[css_url]="+(a.rssfeed_css_url?encodeURIComponent(a.rssfeed_css_url):"")+"&rssfeed[title]="+(a.rssfeed_title?a.rssfeed_title:"")+"&rssfeed[title_name]="+(a.rssfeed_title_name?a.rssfeed_title_name:"")+"&rssfeed[title_bgcolor]="+(a.rssfeed_title_bgcolor?encodeURIComponent(a.rssfeed_title_bgcolor):"")+"&rssfeed[title_color]="+(a.rssfeed_title_color?encodeURIComponent(a.rssfeed_title_color):"")+"&rssfeed[title_bgimage]="+(a.rssfeed_title_bgimage?encodeURIComponent(a.rssfeed_title_bgimage):"")+"&rssfeed[footer]="+(a.rssfeed_footer?a.rssfeed_footer:"")+"&rssfeed[footer_name]="+(a.rssfeed_footer_name?a.rssfeed_footer_name:"")+"&rssfeed[footer_bgcolor]="+(a.rssfeed_footer_bgcolor?encodeURIComponent(a.rssfeed_footer_bgcolor):"")+"&rssfeed[footer_color]="+(a.rssfeed_footer_color?encodeURIComponent(a.rssfeed_footer_color):"")+"&rssfeed[footer_bgimage]="+(a.rssfeed_footer_bgimage?encodeURIComponent(a.rssfeed_footer_bgimage):"")+"&rssfeed[item_bgcolor]="+(a.rssfeed_item_bgcolor?encodeURIComponent(a.rssfeed_item_bgcolor):"")+"&rssfeed[item_bgimage]="+(a.rssfeed_item_bgimage?encodeURIComponent(a.rssfeed_item_bgimage):"")+"&rssfeed[item_title_length]="+(a.rssfeed_item_title_length?a.rssfeed_item_title_length:"")+"&rssfeed[item_title_color]="+(a.rssfeed_item_title_color?encodeURIComponent(a.rssfeed_item_title_color):"")+"&rssfeed[item_border_bottom]="+(a.rssfeed_item_border_bottom?a.rssfeed_item_border_bottom:"")+"&rssfeed[item_source_icon]="+(a.rssfeed_item_source_icon?a.rssfeed_item_source_icon:"")+"&rssfeed[item_date]="+(a.rssfeed_item_date?a.rssfeed_item_date:"")+"&rssfeed[item_description]="+(a.rssfeed_item_description?a.rssfeed_item_description:"")+"&rssfeed[item_description_length]="+(a.rssfeed_item_description_length?a.rssfeed_item_description_length:"")+"&rssfeed[item_description_color]="+(a.rssfeed_item_description_color?encodeURIComponent(a.rssfeed_item_description_color):"")+"&rssfeed[item_description_link_color]="+(a.rssfeed_item_description_link_color?encodeURIComponent(a.rssfeed_item_description_link_color):"")+"&rssfeed[item_description_tag]="+(a.rssfeed_item_description_tag?a.rssfeed_item_description_tag:"")+"&rssfeed[no_items]="+(a.rssfeed_no_items?a.rssfeed_no_items:"")+"&rssfeed[cache]="+(a.rssfeed_cache?a.rssfeed_cache:"");
if(a.rssfeed_border!="off"&&!a.rssfeed_css_url){}
document.write('<iframe name="rssfeed_frame" width="'+a.rssfeed_frame_width+'" height="'+a.rssfeed_frame_height+'" frameborder="0" src="'+c+'" marginwidth="0" marginheight="0" vspace="0" hspace="0" scrolling="no" ALLOWTRANSPARENCY="true"></iframe>')
})()
如果需要任何其他信息,请在拒绝我的问题之前询问。另外,为了将来参考,有没有一种方法可以正确格式化所有内容而无需点击空间一百万次?如果这算作一个额外的问题并且不允许,则忽略。谢谢。