Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi - I am trying to dynamically update the text of a marquee message based on the contents of a file. I want to read the first line of a two line file and assign the value to a variable to update the text of the marquee message. I want to read the second line of the file to update the color of the marquee message which can be red yellow or green.

I am enclosing what I currently have to display a static marquee message below.

Thanks for your assistance.

What I have tried:

<style type="text/css" scoped>
.GeneratedMarquee {
font-family:Arial, sans-serif;
font-size:1.3em;
line-height:1.5em;
background-color: #65A637;   /* I want to update this color based on the second line of the file */
padding:1.5em;
}
</style>

<marquee class="GeneratedMarquee" direction="left" scrollamount="10" behavior="scroll">I want to replace this with the data in the first line of the text file. </marquee>
Posted
Updated 3-Sep-19 15:12pm

Javascript can't directly access files: not on the client (for security reasons) and not on the server (because it's several thousand miles away).

Provided the file is on the server, you can do it in server code (i.e. not Javascript but C#, VB, PHP, or whatever) but even then a text file is a poor idea as it will potentially be opened by multiple users simultaneously.
I'd suggest that you need to think fairly carefully about exactly what you are trying to achieve before you proceed any further ...
 
Share this answer
 
Quote:
I am trying to dynamically update the text of a marquee message based on the contents of a file.

This is the typical usage of PHP.
The webpage is customized on server thank to PHP code embedded in it.
PHP Tutorial[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900