Welcome visitor
* Login
* Register
It is currently July 18th, 2019, 5:22 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » HTML



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  Random CSS each time page is loaded or reloaded
PostPosted: November 17th, 2009, 7:10 am 

Posts: 26
What is the code, or, is it possible to load a random CSS each time a page is loaded? I think I've seen this in other sites but I'm not sure how they did it. Any help is highly appreciated.


Top
 Profile  
 
  Re: Random CSS each time page is loaded or reloaded
PostPosted: November 17th, 2009, 8:08 am 
User avatar

Posts: 56
This works if you have files called file1.css,..., file4.css
<script type="text/javascript">     
//<![CDATA[
function selectcss(){
var t=new Array();
t[1]="1";
t[2]="2";
t[3]="3";
t[4]="4";
var nt=parseInt(4*Math.random()+1);
return nt;}
document.write('<link rel="stylesheet" href="file'+selectcss()+'.css" type="text/css" />');
//]]>
</script>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » HTML


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron