FeedForAll Forum Index  
 Home  •  FAQ  •   Search   •  Register   •  Profile   •  Log in
 rss2html: Links in ItemDescription to PopUp or New Window View next topic
View previous topic
Post new topicReply to topic
Author Message
royhink



Joined: 19 Dec 2011
Posts: 3

PostPosted: Mon Dec 19, 2011 3:35 pm Reply with quoteBack to top

I want to have the links in the ItemDescription to open in a pop up or new window, and I'm having issues with the js. Any help greatly appreciated.

My template:
[code]
<TABLE WIDTH="100%">
~~~BeginItemsRecord~~~
<TR VALIGN="TOP">
<TD>
<BR>
<FONT SIZE="-1">~~~ItemPubDate~~~ </FONT>
<a href="javascript:popUp('~~~ItemLink~~~')"><b>~~~ItemTitle~~~</b></a>
<span class='rssFeed'>~~~ItemDescription~~~</span>
</TD>
</TR>
~~~EndItemsRecord~~~
</TABLE>
[/code]

I've got the following JS script activated onLoad. (The commented out code works, but it causes ALL links on my page to open in a new window. I just want what is within the span tag):
[code]
function RSSnewWindow() {
var frame = parent.document;
//var links = frame.getElementsByTagName('a');
var links = frame.getElementsByTagName('span').getElementsByTagName('a');
for (var i=0; i<links.length; ++i) {
links[i].setAttribute('target','_blank');
}
} [/code]

IDEALLY, I'd prefer it to open in a pop up, and I've got:
[/code]
function popUp(url) {
window.open(url, "", "height=700, width=1000px, resizable, scrollbars, status, location");
}
[code]

Any help greatly appreciated!

Thanks[/code]
View user's profile
royhink



Joined: 19 Dec 2011
Posts: 3

PostPosted: Mon Dec 19, 2011 6:25 pm Reply with quoteBack to top

I've re-written the function to modify the href so that the link will open in a new pop up window.
[code] function RSSnewWindow() {
var frame = parent.document;
var links = frame.getElementsByTagName('a');
for (var i=0; i<links.length; ++i) {
if(links[i].href.indexOf("news.google.com") != -1) {
links[i].href = 'javascript:popUp(\''.concat(links[i].href,'\');')
}
}
}[/code]

This works only with rss from news.google.com. I'd prefer if it found all 'a' tags within a <div class=rssFeed, but
frame.getElementsByClass('rssFeed').getElementsByTagName('a');
doesn't work.

Any help greatly appreciated.
View user's profile
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme