Simple Tutorial to Swap CSS Files for HTML Web Pages

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


Copy this code and paste it in your HTML
  1. <html><head><title>Style Switcher</title>
  2. var StyleFile = "style" + document.cookie.charAt(6) + ".css";
  3. document.writeln('<link rel="stylesheet" type="text/css" href="' + StyleFile + '">');
  4. </head><body><h2>Live in Style</h2><br>
  5. <a href="javascript: document.cookie='style='; window.location.reload();">Style 1</a> |
  6. <a href="javascript: document.cookie='style=2'; window.location.reload();">Style 2</a> |
  7. <a href="javascript: document.cookie='style=3'; window.location.reload();">Style 3</a>
  8. </body></html>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.