2014-12-11 33 views
-3

我使用rss displaysyer javascript解析feed。這是在身體的腳本:如何讓javascript目標空白

<script type="text/javascript"> 
//USAGE SYNTAX: new rssdisplayer("divid", "rssurl", numberofitems, "displayoptions") 
new rssdisplayer("voorpagina", "http://news.google.nl/news?pz=1&cf=all&ned=nl_nl&hl=nl&topic=h&output=rss", 15, "") 
</script> 

有沒有辦法將目標設置在_blank? 謝謝。

+0

我們應該怎麼知道?什麼是rssdisplayer?它可能是任何東西。你應該聯繫寫它的人。 – Brad 2014-12-11 03:41:48

+0

rss顯示器是一個用於解析RSS提要的JavaScript。問題是輸出不是目標空白... – frank 2014-12-11 03:55:55

+0

這還不夠具體。有鏈接?答案在於這個組件是如何編寫的,我們甚至不知道你在使用什麼。 – Brad 2014-12-11 04:08:43

回答

0

如果我理解正確RssDisplayer通過傳遞給它的參數創建HTML視圖。例如,如果你調用

new rssdisplayer("voorpagina", "http://news.google.nl/newspz=1&cf=all&ned=nl_nl&hl=nl&topic=h&output=rss", 15, "") 

它必須產生這樣的:

<a href="http://news.google.nl/newspz=1&cf=all&ned=nl_nl&hl=nl&topic=h&output=rss">voorpagina</a> 
<hr/> 
<a href="http://news.google.nl/m1.html">news 1</a> 
<a href="http://news.google.nl/m2.html">news 2</a> 
<a href="http://news.google.nl/m3.html">news 3</a> 

但是,你需要:

<a href="http://news.google.nl/newspz=1&cf=all&ned=nl_nl&hl=nl&topic=h&output=rss">voorpagina</a> 
<hr/> 
<a href="http://news.google.nl/m1.html" TARGET="_blank">news 1</a> 
<a href="http://news.google.nl/m2.html" TARGET="_blank">news 2</a> 
<a href="http://news.google.nl/m3.html" TARGET="_blank">news 3</a> 

我看到三個途徑獲得:

  • 看看RssDisplayer代碼。可能是它有一個參數來顯示所有新聞'_blank'
  • 如果它沒有你可以改變RssDisplayer的代碼,並自己添加此參數。
  • 或者您可以編寫將在RssDisplayer之後運行並添加到所有鏈接TARGET屬性的JS代碼。