Change two colors in non random order - Javascript jQuery

Javascript examples for jQuery:CSS

Description

Change two colors in non random order

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> 
  <script type="text/javascript">
    $(window).on('load', function() {
var bgcolorlist = new Array("#BAF3C3", "red")
var index = localStorage.getItem("color") == 1 ? 0 : 1;
$("body").css("background-color", bgcolorlist[index]);
localStorage.setItem("color", index);
    });/*from  ww w.  j  a v a 2  s  .  co m*/

      </script> 
 </head> 
 <body>  
 </body>
</html>

Related Tutorials