title: how to change the background image of div using javascript?
body: <p>this is my code</p>
  <pre><code>&lt;div style=&quot;text-align:center;&quot;&gt;
    &lt;div class=&quot;ghor&quot; id=&quot;a&quot; onclick=&quot;chek_mark()&quot;&gt;&lt;/div&gt;
    function call
  &lt;/div&gt;
  &lt;script type=&quot;text/javascript&quot;&gt;
    function chek_mark(){
     var el= document.getElementById(&quot;a&quot;).style.background-image;
     if (el.url(&quot;Black-Wallpaper.jpg&quot;))  
     {
       el.url = &quot;cross1.png&quot;;
      }
      else if(el.url(&quot;cross1.png&quot;))
      {
        alert(&quot;&lt;h1&gt;This is working too.&lt;/h1&gt;&quot;);
       }
     }
  &lt;/script&gt;
  </code></pre>
  <p>here I want to change the background image using if else condition</p>
  <pre><code>this is the style-sheet
  .ghor //this is the div class
  {
      background-image: url('Black-Wallpaper.jpg');
      background-size: cover;
      border-radius: 5px;
      height: 100px;
      width: 100px;
      box-shadow: 2px 5px 7px 7px white;
      /*background-color: black;*/
      display:inline-block; 
  }
  </code></pre>
  <p>i want change the background image of the 'div' which class is 'ghor'</p>