Load Random Stylesheets


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.