There was one problem, I want to change the background of one div when I clicked on the button, but when I call it that way -
document.div.style.background = 'url(second_1.jpg) no-repeat'; then nothing works, the "Cannot read property 'style' of undefined" is written in the console. Here is the whole code:
Js
function new_art() { document.div.style.background = 'url(second_1.jpg)'; } CSS
div { background: url(first_1.jpg) no-repeat; width: 15%; height: 87%; } div:hover { background: url(first_2.jpg); } HTML
<div></div> <input type="button" value="Tap me!" onclick="new_art()">