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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random Color Code for HTML

Status
Not open for further replies.

klear

Technical User
Mar 10, 2003
16
US
Hello I was wondering if there is a Color Code that will let me make a background change to a random Color every time i load a page? Example, when i refresh the page the background color changes. I made a toolbar using an iframe and it is functional but I was wondering if there is a code to make the background color change to a random color for that toolbar.
 
No, there isn't. You will simply have to write a script that loads a different random colour each time the page reloads.

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Would you happen to know where I can find one? I googled one but it wasn't what I was looking for.
 

You could do this serverside or clientside. Clientside code will probably be JavaScript (forum216). Server side will be whatever you know, and whatever your server supports.

Then do a forum search (top of page) to find the appropriate forum. It's a trivial exercise in any of the main serverside languages (ASP, PHP, Perl or whatever)

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
How hard did you search.

[google]random color script[/google]

Like 5 seconds later...

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Don't forget to change the color of text (if any) on that changing background.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Foamcow, thanks for the tip.... I did not use the word script... instead I used the words "html code"... well thanks guys for all the tips.
 
You can't do it with HTML. It must be done client side with Javascript or Server side with PHP/ASP/ColdFusion.

You should realise that HTML is a markup language. All it does is indicate to a machine what a particular bit of text is (a paragraph, a heading, a list item etc). It describes your content.

HTML contains no way of creating interactivity beyond hyperlinks.

HTML contains no way of altering content (barring despicable old fashioned style related tags, but we don't use those right?)

HTML for Content
CSS for style/layout
Javascript for behaviour
Server side scripting for business logic and data handling

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top