Re: JavaScript Trouble, dynamic script not running JS for news feeds?
- From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
- To: <programmingblind@xxxxxxxxxxxxx>
- Date: Sat, 28 Jun 2008 01:43:10 -0700
Thanks, I'll give it a go. I was able to get part of it working once before,
I just wish I remembered how... Though even then, it only worked when the
page first loaded, which I guess sort of defeats the purpose.
----- Original Message -----
From: "Ken Perry" <whistler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Friday, June 27, 2008 10:19 PM
Subject: RE: JavaScript Trouble, dynamic script not running JS for news
feeds?
Ok I was thinking of putting this up on my page and trying it but I have a
suggestion for debugging this. Limit to testing it with one rss feed and
simplify the code as much as you can before you test it. Once you get the
more simple version working then you add the extra feeds.
Ken
-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Bryan
Garaventa
Sent: Friday, June 27, 2008 5:20 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: JavaScript Trouble, dynamic script not running JS for news feeds?
Hi, I've been trying to get this thing working for a few days now, but I
think I'm missing something.
I'm trying to work out a better and more dynamic method for loading the
news
feeds at http://gutterstar.net/news.php All of these news feeds are being
loaded using the script at http://gutterstar.net/rss , which is rendered
within a standard <script type="text/javascript"
src="http://rssScriptGenURLOutput.php?stuffVariables"></script>
My idea is that, if I could dynamically load each RSS feed when a link is
clicked, the load delay would be much less, and no page refresh would
occur
to disrupt navigation.
So I wrote the test page at http://gutterstar.net/news_test.htm Which, by
all that I've read, should work, except that it doesn't...
I was able to get the code below to work briefly when the page first
loaded,
but nothing after that. Now it doesn't even work when the page loads for
some reason. The dynamic aspect just isn't working at all. I've saved out
the live DOM to see if it's adding the correct script to the right Div,
and
everything appears to be updating correctly in the DOM, but I can't see
anything on the page itself, which is really weird. Anyone know what I'm
doing wrong?
<html>
<head>
<script type="text/javascript">
/*<![CDATA[*/
var n1 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn
ews.com%2Ffeeds%2Frss%2Fmain.rss&crss=11940&MAXITEMS=10&HeaderText=Top+Stori
es&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&SectionHea
derClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Secti
onTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Secti
onRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=newsfl
ash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
var n2 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn
ews.com%2Ffeeds%2Frss%2Fworld.rss&crss=11942&MAXITEMS=10&HeaderText=World+Ne
ws&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&SectionHea
derClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Secti
onTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Secti
onRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=newsfl
ash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
var n3 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn
ews.com%2Ffeeds%2Frss%2Fnational.rss&crss=11943&MAXITEMS=10&HeaderText=U.S.+
News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&SectionH
eaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Sec
tionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Sec
tionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=news
flash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
var n4 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Ffeeds.cb
snews.com%2FCBSNewsUTTM&crss=11944&MAXITEMS=10&HeaderText=Up+To+The+Minute%A
0News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Section
HeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Se
ctionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Se
ctionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=new
sflash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
var n5 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn
ews.com%2Ffeeds%2Frss%2Fbusiness.rss&crss=11945&MAXITEMS=10&HeaderText=Busin
ess+News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Sect
ionHeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman
&SectionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS
&SectionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=
newsflash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
var n6 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn
ews.com%2Ffeeds%2Frss%2Fscitech.rss&crss=11946&MAXITEMS=10&HeaderText=Sci-Te
ch%A0News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Sec
tionHeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roma
n&SectionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+M
S&SectionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow
=newsflash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
var n7 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn
ews.com%2Ffeeds%2Frss%2Fpolitics.rss&crss=11948&MAXITEMS=10&HeaderText=Polit
ics%A0News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Se
ctionHeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Rom
an&SectionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+
MS&SectionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindo
w=newsflash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
var n8 =
'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn
ews.com%2Ffeeds%2Frss%2F501370.rss&crss=11951&MAXITEMS=10&HeaderText=Strange
+News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Section
HeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Se
ctionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Se
ctionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=new
sflash&limit=&astr=&ReverseOrder=&license=&ApplyTo=';
function getRSSFeed(url, id) {
var e = document.getElementById(id);
if (e.innerHTML == '') {
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src = url;
e.appendChild(newScript);
}
if (e.style.display == 'none') {
e.style.display = 'block';
e.style.visibility = 'visible';
}
}
/*]]>*/
</script>
</head>
<body>
<div>
<a onclick="getRSSFeed(n1, 'n1d');return false;" href="#">Top Stories</a>|
<a onclick="getRSSFeed(n2, 'n2d');return false;" href="#">World News</a>|
<a onclick="getRSSFeed(n3, 'n3d');return false;" href="#">U.S. News</a>|
<a onclick="getRSSFeed(n4, 'n4d');return false;" href="#">Up To The Minute
News</a>|
<a onclick="getRSSFeed(n5, 'n5d');return false;" href="#">Business
News</a>|
<a onclick="getRSSFeed(n6, 'n6d');return false;" href="#">Sci-Tech
News</a>|
<a onclick="getRSSFeed(n7, 'n7d');return false;" href="#">Politics
News</a>|
<a onclick="getRSSFeed(n8, 'n8d');return false;" href="#">Strange News</a>
</div>
<div style="display:none;visibility:hidden;" id="n1d"></div>
<div style="display:none;visibility:hidden;" id="n2d"></div>
<div style="display:none;visibility:hidden;" id="n3d"></div>
<div style="display:none;visibility:hidden;" id="n4d"></div>
<div style="display:none;visibility:hidden;" id="n5d"></div>
<div style="display:none;visibility:hidden;" id="n6d"></div>
<div style="display:none;visibility:hidden;" id="n7d"></div>
<div style="display:none;visibility:hidden;" id="n8d"></div>
<script type="text/javascript">
getRSSFeed(n8, 'n8d');
</script>
</body></html>
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
__________
View the list's information and change your settings at
http://www.freelists.org/list/programmingblind
- Follow-Ups:
- References:
- jfw question
- From: Juan Hernandez
- Re: jfw question
- From: Octavian Rasnita
- perl - example needed
- From: Lamar Upshaw
- Re: perl - example needed
- From: Octavian Rasnita
- perl - cookies
- From: Lamar Upshaw
- Re: perl - cookies
- From: Octavian Rasnita
- Re: perl - cookies
- From: Lamar Upshaw
- Re: perl - cookies
- From: Octavian Rasnita
- cookies - https://
- From: Lamar Upshaw
- JavaScript Trouble, dynamic script not running JS for news feeds?
- From: Bryan Garaventa
- RE: JavaScript Trouble, dynamic script not running JS for news feeds?
- From: Ken Perry
Other related posts:
- » JavaScript Trouble, dynamic script not running JS for news feeds?
- » RE: JavaScript Trouble, dynamic script not running JS for news feeds?
- » Re: JavaScript Trouble, dynamic script not running JS for news feeds?
- » RE: JavaScript Trouble, dynamic script not running JS for news feeds?
- » Re: JavaScript Trouble, dynamic script not running JS for news feeds?
- » Re: JavaScript Trouble, dynamic script not running JS for news feeds?
- » Re: JavaScript Trouble, dynamic script not running JS for news feeds?
Ok I was thinking of putting this up on my page and trying it but I have a suggestion for debugging this. Limit to testing it with one rss feed and simplify the code as much as you can before you test it. Once you get the more simple version working then you add the extra feeds. Ken -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Bryan Garaventa
Sent: Friday, June 27, 2008 5:20 PM To: programmingblind@xxxxxxxxxxxxx Subject: JavaScript Trouble, dynamic script not running JS for news feeds? Hi, I've been trying to get this thing working for a few days now, but I think I'm missing something.I'm trying to work out a better and more dynamic method for loading the news
feeds at http://gutterstar.net/news.php All of these news feeds are being loaded using the script at http://gutterstar.net/rss , which is rendered within a standard <script type="text/javascript" src="http://rssScriptGenURLOutput.php?stuffVariables"></script> My idea is that, if I could dynamically load each RSS feed when a link isclicked, the load delay would be much less, and no page refresh would occur
to disrupt navigation. So I wrote the test page at http://gutterstar.net/news_test.htm Which, by all that I've read, should work, except that it doesn't...I was able to get the code below to work briefly when the page first loaded,
but nothing after that. Now it doesn't even work when the page loads for some reason. The dynamic aspect just isn't working at all. I've saved outthe live DOM to see if it's adding the correct script to the right Div, and
everything appears to be updating correctly in the DOM, but I can't see anything on the page itself, which is really weird. Anyone know what I'm doing wrong? <html> <head> <script type="text/javascript"> /*<![CDATA[*/ var n1 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn ews.com%2Ffeeds%2Frss%2Fmain.rss&crss=11940&MAXITEMS=10&HeaderText=Top+Stori es&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&SectionHea derClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Secti onTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Secti onRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=newsfl ash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; var n2 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn ews.com%2Ffeeds%2Frss%2Fworld.rss&crss=11942&MAXITEMS=10&HeaderText=World+Ne ws&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&SectionHea derClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Secti onTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Secti onRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=newsfl ash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; var n3 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn ews.com%2Ffeeds%2Frss%2Fnational.rss&crss=11943&MAXITEMS=10&HeaderText=U.S.+ News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&SectionH eaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Sec tionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Sec tionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=news flash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; var n4 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Ffeeds.cb snews.com%2FCBSNewsUTTM&crss=11944&MAXITEMS=10&HeaderText=Up+To+The+Minute%A 0News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Section HeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Se ctionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Se ctionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=new sflash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; var n5 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn ews.com%2Ffeeds%2Frss%2Fbusiness.rss&crss=11945&MAXITEMS=10&HeaderText=Busin ess+News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Sect ionHeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman &SectionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS &SectionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow= newsflash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; var n6 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn ews.com%2Ffeeds%2Frss%2Fscitech.rss&crss=11946&MAXITEMS=10&HeaderText=Sci-Te ch%A0News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Sec tionHeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roma n&SectionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+M S&SectionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow =newsflash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; var n7 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn ews.com%2Ffeeds%2Frss%2Fpolitics.rss&crss=11948&MAXITEMS=10&HeaderText=Polit ics%A0News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Se ctionHeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Rom an&SectionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+ MS&SectionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindo w=newsflash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; var n8 = 'http://gutterstar.net/cgi-bin/apps/rss/js.php?RSSFILE=http%3A%2F%2Fwww.cbsn ews.com%2Ffeeds%2Frss%2F501370.rss&crss=11951&MAXITEMS=10&HeaderText=Strange +News&TitleText=&TableWidth=&TableHeight=&TableAlign=&TextAlign=left&Section HeaderClr=%236a5acd&SectionHeaderSize=2&SectionHeaderFont=Times+New+Roman&Se ctionTitleClr=%23228b22&SectionTitleSize=2&SectionTitleFont=Comic+Sans+MS&Se ctionRowClr=%2300bfff&SectionRowSize=2&SectionRowFont=Verdana&OpenWindow=new sflash&limit=&astr=&ReverseOrder=&license=&ApplyTo='; function getRSSFeed(url, id) { var e = document.getElementById(id); if (e.innerHTML == '') { var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = url; e.appendChild(newScript); } if (e.style.display == 'none') { e.style.display = 'block'; e.style.visibility = 'visible'; } } /*]]>*/ </script> </head> <body> <div> <a onclick="getRSSFeed(n1, 'n1d');return false;" href="#">Top Stories</a>| <a onclick="getRSSFeed(n2, 'n2d');return false;" href="#">World News</a>| <a onclick="getRSSFeed(n3, 'n3d');return false;" href="#">U.S. News</a>| <a onclick="getRSSFeed(n4, 'n4d');return false;" href="#">Up To The Minute News</a>|<a onclick="getRSSFeed(n5, 'n5d');return false;" href="#">Business News</a>|
<a onclick="getRSSFeed(n6, 'n6d');return false;" href="#">Sci-Tech News</a>|
<a onclick="getRSSFeed(n7, 'n7d');return false;" href="#">Politics News</a>|
<a onclick="getRSSFeed(n8, 'n8d');return false;" href="#">Strange News</a> </div> <div style="display:none;visibility:hidden;" id="n1d"></div> <div style="display:none;visibility:hidden;" id="n2d"></div> <div style="display:none;visibility:hidden;" id="n3d"></div> <div style="display:none;visibility:hidden;" id="n4d"></div> <div style="display:none;visibility:hidden;" id="n5d"></div> <div style="display:none;visibility:hidden;" id="n6d"></div> <div style="display:none;visibility:hidden;" id="n7d"></div> <div style="display:none;visibility:hidden;" id="n8d"></div> <script type="text/javascript"> getRSSFeed(n8, 'n8d'); </script> </body></html> __________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind __________ View the list's information and change your settings at http://www.freelists.org/list/programmingblind
- jfw question
- From: Juan Hernandez
- Re: jfw question
- From: Octavian Rasnita
- perl - example needed
- From: Lamar Upshaw
- Re: perl - example needed
- From: Octavian Rasnita
- perl - cookies
- From: Lamar Upshaw
- Re: perl - cookies
- From: Octavian Rasnita
- Re: perl - cookies
- From: Lamar Upshaw
- Re: perl - cookies
- From: Octavian Rasnita
- cookies - https://
- From: Lamar Upshaw
- JavaScript Trouble, dynamic script not running JS for news feeds?
- From: Bryan Garaventa
- RE: JavaScript Trouble, dynamic script not running JS for news feeds?
- From: Ken Perry