Now that Twitter has changed their API we can't use that medium to create "news items" for our website.
So rather than have to update HTML pages I thought we would go down the "upload simple text file and let javascript take care of it" route.
I threw together a javascript file (news.js) containing a piece of code: HTML
In the HTML page I have added:
<script type="text/javascript" src="news.js"></script>
to the header section.
In the body I have added
<DIV id="newsitems" width="100%"></DIV>
which is where I want the news items to appear
After the </BODY> tag I have added
<SCRIPT language="JavaScript">
printnewsitems();
</SCRIPT>
I uploaded the test page and js file.
Page loads as expected, but the news items do not display.
Any ideas gratefully received!
Thanks
So rather than have to update HTML pages I thought we would go down the "upload simple text file and let javascript take care of it" route.
I threw together a javascript file (news.js) containing a piece of code: HTML
JavaScript:
newsArray = new Array(
"Title1",
"News Item 1 description text.",
"Title2",
"News Item 2 description text.",
"Title3",
"News Item 3 description text.",
"Title4",
"News Item 4 description text.",
"", "");
function printnewsitems(){
var news_str = "";
for(i=0; i<(newsArray.length-2); i+=2){
news_str += "<b>" + newsArray[i] + "</b><br>" + newsArray[i+1] + "<br><br>";
}
if (document.all){
document.all['newsitems'].innerHTML = news_str;
}
else{
var a_n_other= document.getElementById("newsitems");
a_n_other.innerHTML = news_str;
}
}
In the HTML page I have added:
<script type="text/javascript" src="news.js"></script>
to the header section.
In the body I have added
<DIV id="newsitems" width="100%"></DIV>
which is where I want the news items to appear
After the </BODY> tag I have added
<SCRIPT language="JavaScript">
printnewsitems();
</SCRIPT>
I uploaded the test page and js file.
Page loads as expected, but the news items do not display.
Any ideas gratefully received!
Thanks