Appreciate hep....text color should change with every refresh

Questions and tutorials related to Cascading Style Sheets *all versions*

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 13
Joined: Thu Feb 05, 2015 12:21 pm

Wed Oct 19, 2016 12:13 pm

Hi All,

Appreciate help in resolving the below issues.....

With every refresh I wanted to change the text color in marquee tag by calling javascript function......
I am getting color code like #18EEC5 ......but when calling script function from marquee tag nothing is happening......

<script type="text/javascript">
function getRandomColor() {
var letters = '0123456789ABCDEF';
var color = '#';
for (i = 0; i < 6; i++ ) {
color += letters[Math.floor(Math.random() * 16)];
return color;
<marquee style="color: 'document.write(getRandomColor())'; font-size: 20pt; font-weight: bold">
Text Color Changes

php-forum Super User
php-forum Super User
Posts: 197
Joined: Wed Jun 15, 2016 8:35 am

Wed Oct 19, 2016 1:27 pm

See my answer in your other post in the JavaScript forum.
Post Reply