PDA

View Full Version : Loading Random javascript into headers


SkyCatcher
11-02-2006, 04:05 PM
Right now I have a .js file that I loaded into the header.

Is it possible to randomize the file loaded somehow?

So that if I have 5 .js files (1.js, 2.js, 3.js etc) a different file would be loaded with every page refresh or page?

Thanks to a post by ConqSoft:

A new plugin:

mt_srand((double)microtime()*1000000);
$randheader = mt_rand(1, 2);


then just use scr="filename$randheader.js" to load filename1 filename2 etc randomly.

Incase anyone else needed it.