JSFiddle - React, Tailwind, and code Playground

HTML

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

CSS

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

JavaScript

var bodyObj, imgSrc, index;

bodyObj = document.getElementById('body');
index = 0;
imgSrc = [
    'http://wallpapersus.com/wp-content/uploads/2012/10/Black-Background-Metal.jpg',
    'http://www.hdwallpapers.in/walls/abstract_color_background_picture_8016-wide.jpg'
];

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

window.onload = function(){
    bodyObj.style.backgroundImage = 'url("' + imgSrc[index] + '")';
    updateIndex();
};

bodyObj.onclick = function(e){
    e.currentTarget.style.backgroundImage = 'url("' + imgSrc[index] + '")';
    updateIndex();
}