JSFiddle - React, Tailwind, and code Playground

HTML

<div id="body" class="imageOne"></div>

CSS

html, body, #body {
    height: 100%;
    width: 100%;
}

#body.imageOne {
    background-image: url("http://www.hdwallpapers.in/walls/abstract_color_background_picture_8016-wide.jpg");
}

#body.imageTwo {
    background-image: url("http://wallpapersus.com/wp-content/uploads/2012/10/Black-Background-Metal.jpg");
}

JavaScript

var bodyObj, className, index;

bodyObj = document.getElementById('body');
index = 1;
className = [
    'imageOne',
    'imageTwo'
];

function updateIndex(){
    if(index === 0){
        index = 1;
    }else{
        index = 0;
    }
}

bodyObj.onclick = function(e){
    e.currentTarget.className = className[index];
    updateIndex();
}