Your HostICan Community  


Go Back   Your HostICan Community > Programming & Design > Javascript / Java Applets

Javascript / Java Applets Are you a JavaScript guy? Do you need help with JavaScript? This is the place to talk about anything related to Java.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-06-2009, 05:01 PM
deangelo deangelo is offline
Junior Member
 
Join Date: Mar 2009
Posts: 3
Default colouring of tables when refresh a page from my hosting account

I have an idea, but I do not know how to realize it. I would like when some visitor did refresh to my website all tables in it to become in a different colour.
Reply With Quote
  #2  
Old 08-06-2009, 06:04 PM
Liona's Avatar
Liona Liona is offline
Member
 
Join Date: Jan 2009
Location: Buenos Aires
Posts: 85
Default Re: colouring of tables when refresh a page from my hosting account

Put this part of code between head tag:
HTML Code:
<script type="text/javascript">
var randombgcolors=["green:white:yellow", "#DDF4FF", "#FFFF97", "#CFFF9F "]
//here add colours by your choice
var rbcssrule=""
var randomnum=Math.floor(Math.random()*randombgcolors.length)
if (randombgcolors[randomnum].indexOf(":")!=-1){
rbcssrule="background-color: "+randombgcolors[randomnum].split(":")[0]+";"
rbcssrule+="color: "+randombgcolors[randomnum].split(":")[1]+";"
}
else
rbcssrule="background-color: "+randombgcolors[randomnum]+";"
document.write('<style type="text/css">\n')
document.write('.randomcolor{'+rbcssrule+'}\n')
if (randombgcolors[randomnum].split(":").length==3) //if link colour specified
document.write('.randomcolor a{color:'+randombgcolors[randomnum].split(":")[2]+';}\n')
document.write('<\/style>')
</script> 
Then, use class="randomcolor" for each div. For example:
HTML Code:
<div class="randomcolor">text,text</div> 
Reply With Quote
Reply

Tags
account, colouring, hosting, page, refresh, tables

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 04:04 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Copyright © 2003 - 2008 HostICan. All Rights Reserved.