Posted By

Roshambo on 10/03/06


Tagged

css random stylesheet


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

leitmotiv
Hirmine


Load Random Stylesheets


 / Published in: JavaScript
 

  1. // Loads a stylesheet at random. Pass each stylesheet as an argument.
  2. function loadRandomStylesheets(stylesheets)
  3. {
  4. if(arguments.length < 1) return false;
  5. var url = arguments[Math.round(Math.random() * (arguments.length - 1))];
  6. var html = '<style type="text/css">\
  7. @import url(' + url + ');\
  8. </style>';
  9. document.write(html);
  10. return true;
  11. }

Report this snippet  

You need to login to post a comment.