Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scroller help needed

Status
Not open for further replies.

BRIT1956

Technical User
Dec 29, 2001
7
GB
Well it's been a while since I last called by, I hope somebody can help.

I'm putting together a webpage for a guy who is a total moron when it comes to puters, however he needs to update a news scroller weekly, can a scroller call a text file from a seperate folder in the route directory, if so some help please, javascript is not my strongpoint.

My thinking is he could update a textfile produced with notepad and just put it in the folder whenever he needs to and the script will read whatever the filename is, that is if I can get the simplicity of uploading via ftp thru to him!!
 
The ideal way to do this would be to use server-side scripting (ASP, PHP, etc.). Is that an option?

--Chessbot

"Violence is the last refuge of the incompetent." -- Asimov, Foundation
 
No, want to keep it all in one place for my simplicity when it comes to sorting stuff out at a later date. I'm sure he's gonna ask me to keep it up and running tho I don't want to, work colleagues huh!
 
Create an external JavaScript file with content like this:
Code:
function newsText(){/* DO NOT MODIFY THIS LINE

News
More News
Even more news

*/}// DO NOT MODIFY THIS LINE

Then you can get the content using this:
Code:
<script src="newsContent.js"></script>
<script>
Function.prototype.getComment=function(){
  return this.toString().match(/\/\*[^\n]*\n([^(\*\/)]*)\*\//)[1];
}

var news = newsText.getComment();
alert(news);
</script>

Adam
while(ignorance){perpetuate(violence,fear,hatred);life=life-1};
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top