Click here to Skip to main content
14,298,693 members
Rate this:
Please Sign up or sign in to 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
Rate this:
Please Sign up or sign in to vote.

Solution 1

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 ...
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

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[^]
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100